Last active
June 8, 2019 23:25
-
-
Save krambuhl/63f1788c2641266c8119c81efe88c072 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// variable : type annotation | |
// name : ArgumentType -> ArgumentType -> ReturnType | |
// fnAdd : (Num, Num) -> Num | |
function addFn(a, b) { return a + b; } | |
// ex. | |
addFn(1, 2) === 3 | |
// arrowAdd : (Num, Num) -> Num | |
const arrowAdd = (a, b) => a + b; | |
// ex. | |
arrowAdd(1, 2) === 3 | |
// curryAdd : Num -> Num -> Num | |
const curryAdd = a => b => a + b + c; | |
// ex. | |
curryAdd(2)(1) === 3 | |
// add2 : Num -> Num | |
const add2 = curryAdd(2); | |
// ex. | |
add2(1) === 3 | |
// gulpPlugin : Object -> () -> GulpStream | |
const gulpPlugin = options => () => { | |
return through.obj((file, enc, done) { | |
done(null, file); | |
}) | |
} | |
// ex. | |
gulp.src('*') | |
.pipe(gulpPlugin({ prop: 'value' })) | |
.dest('dist') | |
const genericError = errCode => errorMsg => { | |
console.log(`${errCode}: ${errorMsg}`); | |
} | |
genericError(404)('page is missing') // 404: page is missing | |
const pageMissingError = genericError(404); | |
pageMissingError('page is missing') // 404: page is missing | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment