This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.

23 lines
699 B
Markdown
Raw Permalink Normal View History

2021-04-02 02:24:13 +03:00
args array [![Build Status](https://travis-ci.org/calvinmetcalf/argsarray.png)](https://travis-ci.org/calvinmetcalf/argsarray)
===
```bash
npm install argsarray
```
simple library to treat function arguments as an array without leaking the arguments object ([which is bad](https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments)), based on something I wrote for [PouchDB](https://github.com/daleharvey/pouchdb).
Simple wrap a function in this and the function will always be called with an array of the arguments it was called with.
```js
var myFunc = argsarray(function myFunc(args) {
console.log(args);
});
myFunc(a, b, c);
//[a, b, c];
```
#license
wtfpl