Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/ndhoule/nary

Wrap a function in a function that only accepts a predefined number of arguments.
https://github.com/ndhoule/nary

Last synced: 13 days ago
JSON representation

Wrap a function in a function that only accepts a predefined number of arguments.

Awesome Lists containing this project

README

        

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

Wrap a function so that it only accepts a predefined number of arguments.

## Installation

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

## API

### `nary(n : number, func: Function)`

Wrap a function in a wrapper that passes a maximum of `n` arguments to the wrapped function.

```javascript
['1', '2', '3'].map(nary(1, parseInt)); // => [1, 2, 3]
```

## License

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

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