Created
June 13, 2018 04:36
-
-
Save icyJoseph/729f18a57c8e6b498f40690c12b14574 to your computer and use it in GitHub Desktop.
Functional Pack
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
export const curry = f => a => (...b) => f(a,...b) | |
export const pipe = (...funcs) => (...args) => funcs.reduce((res, func, i) => (i === 0 ? func(...res) : func(res)), args); | |
export const mapf = (func, arr) => arr.map(func); | |
export const filterf = (func, arr) => arr.filter(func); | |
export const flatten = arr => [].concat(...arr); | |
export const take = (n, m = 0) => arr => arr.slice(m, n + m); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment