Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ndhoule/invoker

Creates a function that invokes a named method.
https://github.com/ndhoule/invoker

Last synced: 13 days ago
JSON representation

Creates a function that invokes a named method.

Awesome Lists containing this project

README

        

# invoker [![CI][ci-badge]][ci-link]

Creates a function that invokes a given method.

## Installation

```sh
$ component install ndhoule/invoker
$ npm install @ndhoule/invoker
```

## API

### `invoker(method : Function|string) => Function(receiver, ...args)`

Accepts a method name or a function, and returns a function that invokes that method on a receiver.

```javascript
var map = invoker('map');
map([1, 2, 3], function(num) {
return num + 1;
});
//=> [2, 3, 4]
```

## License

Released under the [MIT license](LICENSE.md).

[ci-link]: https://travis-ci.org/ndhoule/invoker
[ci-badge]: https://travis-ci.org/ndhoule/invoker.svg?branch=master