Skip to content

Instantly share code, notes, and snippets.

@xcoderzach
Last active August 29, 2015 14:15
Show Gist options
  • Save xcoderzach/460e3a5f867fddf3509b to your computer and use it in GitHub Desktop.
Save xcoderzach/460e3a5f867fddf3509b to your computer and use it in GitHub Desktop.
Function Bind Syntax
import _ from 'lodash'
function ooify(fn) {
return function() {
return fn.apply(this, [this].concat([].slice.call(arguments)))
}
}
var methods = _.zipObject(_.map(_.keys(_.prototype), methodName => {
return [methodName, ooify(_[methodName])]
}))
var { sortBy, filter, map } = methods
var array = [1, 2, 3, 14, 2, 35, 73, 8, 77]
array = array
::sortBy(y => y)
::map(y => y)
::filter(y => y % 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment