memomima

0.1.2 • Public • Published

memomima

A memoization function. Uses JSON.stringify for objects arguments.

File size: 495 bytes.
Supported platforms: server and browser.
Supported language versions: ES5 and above.

If you use this library in your software please tweet me @benastontweet.

Installation

npm install memomima

Example

var memoize = require('memomima').memoize;

//arrange
var o, fn;

o = {
	foo: function() {}
};
spyOn(o, 'foo').and.callThrough();            
function fn() { return o.foo(); }

//act & assert
fn();
fn();
expect(o.foo.calls.count()).toBe(2);

fn = memoize(fn);
fn();
fn();
expect(o.foo.calls.count()).toBe(3); // Not 4!

License & Copyright

This software is released under the MIT License. It is Copyright 2015, Ben Aston. I may be contacted at ben@bj.ma.

How to Contribute

Pull requests including bug fixes, new features and improved test coverage are welcomed. Please do your best, where possible, to follow the style of code found in the existing codebase.

Readme

Keywords

Package Sidebar

Install

npm i memomima

Weekly Downloads

2

Version

0.1.2

License

MIT

Last publish

Collaborators

  • benaston