README
opti
DRAFT RELEASE
Optimized methods for speeding and (avoiding) memory leaks.
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);
}