Skip to content

Instantly share code, notes, and snippets.

@chmelevskij
Created April 2, 2018 16:31
Show Gist options
  • Save chmelevskij/504ea1f47f48b9e6041fa9c6d4388c95 to your computer and use it in GitHub Desktop.
Save chmelevskij/504ea1f47f48b9e6041fa9c6d4388c95 to your computer and use it in GitHub Desktop.
Poor Mans Lodash
/**
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