lomemo
v1.0.0
Published
Lodash's memoize function, but in a much smaller package than lodash.memoize's.
Downloads
15,426
Maintainers
Readme
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