![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/dceprojects.corals.io/node_modules/simple-swizzle/ |
# 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).