node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org »

yak

yak

A functional method to invoke a method from an object.

usage

example 1

var x = 123;
var results = yak("toString")(x);
// results = '123' 

example 2

var objs = [
  {foo: function() { return this.bar.split('').reverse().join('') }, bar: 'bam'},
  {foo: function() { return this.bar.split('').reverse().join('') }, bar: 'baz'},
]
var results = objs.map(yak('foo'));
// results should equal ['mab','zab'] 

install

npm install yak

contribute

pull requests welcome

license

MIT

Thanks to