Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #sliced
  2. ==========
  3. A faster alternative to `[].slice.call(arguments)`.
  4. [![Build Status](https://secure.travis-ci.org/aheckmann/sliced.png)](http://travis-ci.org/aheckmann/sliced)
  5. Example output from [benchmark.js](https://github.com/bestiejs/benchmark.js)
  6. Array.prototype.slice.call x 1,401,820 ops/sec ±2.16% (90 runs sampled)
  7. [].slice.call x 1,313,116 ops/sec ±2.04% (96 runs sampled)
  8. cached slice.call x 10,297,910 ops/sec ±1.81% (96 runs sampled)
  9. sliced x 19,906,019 ops/sec ±1.23% (89 runs sampled)
  10. fastest is sliced
  11. Array.prototype.slice.call(arguments, 1) x 1,373,238 ops/sec ±1.84% (95 runs sampled)
  12. [].slice.call(arguments, 1) x 1,395,336 ops/sec ±1.36% (93 runs sampled)
  13. cached slice.call(arguments, 1) x 9,926,018 ops/sec ±1.67% (92 runs sampled)
  14. sliced(arguments, 1) x 20,747,990 ops/sec ±1.16% (93 runs sampled)
  15. fastest is sliced(arguments, 1)
  16. Array.prototype.slice.call(arguments, -1) x 1,319,908 ops/sec ±2.12% (91 runs sampled)
  17. [].slice.call(arguments, -1) x 1,336,170 ops/sec ±1.33% (97 runs sampled)
  18. cached slice.call(arguments, -1) x 10,078,718 ops/sec ±1.21% (98 runs sampled)
  19. sliced(arguments, -1) x 20,471,474 ops/sec ±1.81% (92 runs sampled)
  20. fastest is sliced(arguments, -1)
  21. Array.prototype.slice.call(arguments, -2, -10) x 1,369,246 ops/sec ±1.68% (97 runs sampled)
  22. [].slice.call(arguments, -2, -10) x 1,387,935 ops/sec ±1.70% (95 runs sampled)
  23. cached slice.call(arguments, -2, -10) x 9,593,428 ops/sec ±1.23% (97 runs sampled)
  24. sliced(arguments, -2, -10) x 23,178,931 ops/sec ±1.70% (92 runs sampled)
  25. fastest is sliced(arguments, -2, -10)
  26. Array.prototype.slice.call(arguments, -2, -1) x 1,441,300 ops/sec ±1.26% (98 runs sampled)
  27. [].slice.call(arguments, -2, -1) x 1,410,326 ops/sec ±1.96% (93 runs sampled)
  28. cached slice.call(arguments, -2, -1) x 9,854,419 ops/sec ±1.02% (97 runs sampled)
  29. sliced(arguments, -2, -1) x 22,550,801 ops/sec ±1.86% (91 runs sampled)
  30. fastest is sliced(arguments, -2, -1)
  31. _Benchmark [source](https://github.com/aheckmann/sliced/blob/master/bench.js)._
  32. ##Usage
  33. `sliced` accepts the same arguments as `Array#slice` so you can easily swap it out.
  34. ```js
  35. function zing () {
  36. var slow = [].slice.call(arguments, 1, 8);
  37. var args = slice(arguments, 1, 8);
  38. var slow = Array.prototype.slice.call(arguments);
  39. var args = slice(arguments);
  40. // etc
  41. }
  42. ```
  43. ## install
  44. npm install sliced
  45. [LICENSE](https://github.com/aheckmann/sliced/blob/master/LICENSE)