fdsfd
This commit is contained in:
parent
628618df89
commit
e031240dff
3749 changed files with 1120848 additions and 1 deletions
39
node_modules/simple-swizzle/README.md
generated
vendored
Normal file
39
node_modules/simple-swizzle/README.md
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
# simple-swizzle [](https://travis-ci.org/Qix-/node-simple-swizzle) [](https://coveralls.io/r/Qix-/node-simple-swizzle)
|
||||
|
||||
> [Swizzle](https://en.wikipedia.org/wiki/Swizzling_(computer_graphics)) your function arguments; pass in mixed arrays/values and get a clean array
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var swizzle = require('simple-swizzle');
|
||||
|
||||
function myFunc() {
|
||||
var args = swizzle(arguments);
|
||||
// ...
|
||||
return args;
|
||||
}
|
||||
|
||||
myFunc(1, [2, 3], 4); // [1, 2, 3, 4]
|
||||
myFunc(1, 2, 3, 4); // [1, 2, 3, 4]
|
||||
myFunc([1, 2, 3, 4]); // [1, 2, 3, 4]
|
||||
```
|
||||
|
||||
Functions can also be wrapped to automatically swizzle arguments and be passed
|
||||
the resulting array.
|
||||
|
||||
```js
|
||||
var swizzle = require('simple-swizzle');
|
||||
|
||||
var swizzledFn = swizzle.wrap(function (args) {
|
||||
// ...
|
||||
return args;
|
||||
});
|
||||
|
||||
swizzledFn(1, [2, 3], 4); // [1, 2, 3, 4]
|
||||
swizzledFn(1, 2, 3, 4); // [1, 2, 3, 4]
|
||||
swizzledFn([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).
|
Loading…
Add table
Add a link
Reference in a new issue