diff --git a/docs/array/arguments.md b/docs/array/arguments.md index 40ff769..711d03c 100644 --- a/docs/array/arguments.md +++ b/docs/array/arguments.md @@ -10,4 +10,20 @@ Only use: * STRICTLY `fn.apply(y, arguments)` is ok, nothing else is (e.g. `.slice`). That's because `Function#apply` is special. * Be aware that adding properties to functions (e.g. `fn.$inject =...`) and bound functions (i.e. the result of `Function#bind`) generate hidden classes and, therefore, are not safe when using `.apply`. -If you need to manipulate `arguments`, use a copy. [sliced](https://github.com/aheckmann/sliced) is a good tiny library for this purpose. +If you need to process the input of a function as an `array`, a good perfomance approach is manipulate a copy of `arguments`. You can do it using `spread operator`: + +```js +function spreadOp(...args) { + return other(args) +} +``` + +If you are in a scenario where is not possible to use `spread operator`, we recommend use the tiny [sliced](https://github.com/aheckmann/sliced) library for make an a copy of the `array`: + +```js +const sliced = require('sliced'); + +function myFunctionWithArgs() { + const args = sliced(arguments) +} +```