JSPM

fast-apply

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 987
  • Score
    100M100P100Q105169F
  • License MIT

Apply an array of arguments... faster

Package Exports

  • fast-apply

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fast-apply) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fast-apply

Apply an array of arguments... faster.

var fastApply = require('fast-apply')
  , scope = {}
;

function run() {}

fastApply(run, scope, [ 'a', 'b', 'c' ]);

Installation

$ npm install fast-apply

Dependencies

none

Speed

It uses a simple switch statement to call the function rather than apply for up to 5 arguments.

While more than 5 arguments would run faster using apply, anything less will be up to twice as fast

If the scope is null, fastApply will run up to 3 times faster than apply

Limitations

  • It is only optimized for 5 arguments or less. If you think the function will frequently be taking more than 5 arguments, I suggest that you instead use apply