0.0.1 • Published 2 years ago

opti v0.0.1

Weekly downloads
3
License
MIT
Repository
-
Last release
2 years ago

opti

DRAFT RELEASE

Optimized methods for speeding and (avoiding) memory leaks.

NPM Version NPM Downloads License

Install

$ npm install opti --save

Usage

fnApply

Call a method with a given context and arguments as an Array.

function fn(a, b, c) {
  // logic
}

// Wrong

fn.apply(this, ['a', 'c', 'c']);

// Right

var opti = require('opti');

opti.fnApply(fn, this, ['a', 'c', 'c']);

toArray

Transform the method's arguments into an Array.

// Wrong

function fn(a, b, c) {
  var args = Array.prototype.slice.call(arguments, 0);
}

// Right

var opti = require('opti');

function fn(a, b, c) {
  var args = opti.toArray(arguments, 0);
}

License

MIT