Last active
August 29, 2015 14:15
-
-
Save xcoderzach/460e3a5f867fddf3509b to your computer and use it in GitHub Desktop.
Function Bind Syntax
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
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