cache-last

0.0.2 • Public • Published

Cache-Last

It's customed ** memoize ** in lodash that only cache last call.

See details in here

Example

var cacheLast = require('cache-last').default;
 
function slowFunction(n) {
  for(var i = 0; i < n; i++) ;
  return n;
}
 
var fn = cacheLast(slowFunction);
fn(1000000000); // first run, slow
fn(1000000000); // cached, faster

/cache-last/

    Package Sidebar

    Install

    npm i cache-last

    Weekly Downloads

    12

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • raininfall