simple-swizzle
Advanced tools
Comparing version
@@ -6,3 +6,3 @@ 'use strict'; | ||
module.exports = function swizzle(args) { | ||
var swizzle = module.exports = function swizzle(args) { | ||
var results = []; | ||
@@ -24,1 +24,7 @@ | ||
}; | ||
swizzle.wrap = function (fn) { | ||
return function () { | ||
return fn(swizzle(arguments)); | ||
}; | ||
}; |
{ | ||
"name": "simple-swizzle", | ||
"description": "Simply swizzle your arguments", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"author": "Qix (http://github.com/qix-)", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -21,4 +21,21 @@ # simple-swizzle [](https://travis-ci.org/Qix-/node-simple-swizzle) [](https://coveralls.io/r/Qix-/node-simple-swizzle) | ||
Functions can also be wrapped to automatically swizzle arguments and be passed | ||
the resulting array. | ||
```js | ||
var swizzle = require('simple-swizzle'); | ||
var sfn = swizzle.wrap(function (args) { | ||
// ... | ||
return args; | ||
}); | ||
sfn(1, [2, 3], 4); // [1, 2, 3, 4] | ||
sfn(1, 2, 3, 4); // [1, 2, 3, 4] | ||
sfn([1, 2, 3, 4]); // [1, 2, 3, 4] | ||
``` | ||
## License | ||
Licensed under the [MIT License](http://opensource.org/licenses/MIT). | ||
You can find a copy of it in [LICENSE](LICENSE). |
3559
13.96%22
29.41%41
70.83%