Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/ndhoule/nary
- Owner: ndhoule
- License: mit
- Created: 2015-02-25T08:55:33.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-29T23:00:20.000Z (over 8 years ago)
- Last Synced: 2024-08-10T03:13:56.541Z (3 months ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE.md
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