Created
April 2, 2018 16:31
-
-
Save chmelevskij/504ea1f47f48b9e6041fa9c6d4388c95 to your computer and use it in GitHub Desktop.
Poor Mans Lodash
This file contains hidden or 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
/** | |
unwrap functional power from Arrays | |
*/ | |
const keys = [ | |
'concat', | |
'entries', | |
'every', | |
'filter', | |
'find', | |
'findIndex', | |
'includes', | |
'indexOf', | |
'join', | |
'keys', | |
'lastIndexOf', | |
'map', | |
'reduce', | |
'reduceRight', | |
'slice', | |
'some', | |
'sort', | |
'values', | |
] | |
const extract = method => f => arr => Array.prototype[method].bind(arr, f)() | |
const T = keys.reduce((acc, k) => { | |
acc[k] = extract(k) | |
return acc | |
}, {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment