Functions
compose
compose(...fns ) > Function
execute right to left function list
const creatures = [{name:'dragon', attack:10}, {name:'troll', attack:5}, {name:'gobelin', attack:1}]
const getAttackValues = get('attack') //get attack value
const isGreaterthan1 = gt(1) //valid condition n > 1
const myFilter = compose(isGreaterthan1, getAttackValues) //compose function
const result = creatures.filter(myFilter) // return [{name:'dragon', attack:10}, {name:'troll', attack:5}]
curry
curry( fn ) > Function
curry function
const add = (x,y) => x+y
const z = curry(add)
const result = z(2)(3) //return 5
debounce
debounce( fn, wait, immediate) > void
create a debounce function
const count = (x) => x + 1
const d = debounce(count, 1000)
d(1) //call count
not
not( value ) > Boolean
test if value !== false
not(true) //return false
not(false) //return true
pipe
pipe( ...fns) > Function
execute left to rigth function
const creatures = [{name:'dragon', attack:10}, {name:'troll', attack:5}, {name:'gobelin', attack:1}]
const getAttackValues = get('attack') //get attack value
const isGreaterthan1 = gt(1) //valid condition n > 1
const myFilter = pipe(getAttackValues, isGreaterthan1) //pipe function
const result = creatures.filter(myFilter) //return [{name:'dragon', attack:10}, {name:'troll', attack:5}]