yak

A functional invoke method

npm install yak
1 downloads in the last month

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

npm loves you