1.0.0 • Published 20 days ago

lomemo v1.0.0

Weekly downloads
-
License
-
Repository
github
Last release
20 days ago

Lomemo

Lodash's memoize function, but in a much smaller package than lodash.memoize's.

Read lodash's docs for more info.

Install

npm install --save lomemo

Usage

import lomemo from 'lomemo';

// Memoize a function, using the first argument as the key

const memoize = lomemo ( ( a, b ) => a + b );

memoize ( 1, 2 ); // => 3
memoize ( 1, 5 ); // => 3

// Memoize a function, using a custom function to generate the key

const resolver = ( ...args ) => args.join ( '' );
const memoize = lomemo ( ( a, b ) => a + b, resolver );

memoize ( 1, 2 ); // => 3
memoize ( 1, 5 ); // => 6
memoize ( '', '15' ); // => 6

License

MIT © lodash

1.0.0

20 days ago