opti

Optimized methods for speeding and (avoiding) memory leaks

Usage no npm install needed!

<script type="module">
  import opti from 'https://cdn.skypack.dev/opti';
</script>

README

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