Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Object.defineProperty Object.prototype, '_bind',
- enumerable: false
- get: ->
- new Proxy this,
- get: (thing, prop) =>
- thing[prop].bind(thing)
- # Usage
- foo.on 'thing', console._bind.log
- Function::curry = (params...) ->
- (rest...) => this(params..., rest...)
- # Usage
- foo.on 'thing', log.curry('A thing:')
- _ = _it = new Proxy {},
- get: (_, prop) ->
- retrieve = (props...) ->
- fn = (obj) ->
- props.reduce (obj, prop) ->
- obj[prop]
- , obj
- new Proxy fn,
- get: (_, prop) ->
- retrieve(props..., prop)
- retrieve(prop)
- # Usage
- foo.map _.some.field
Add Comment
Please, Sign In to add comment