1.0.1 • Published 5 months ago

lomemo v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months 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 lomemo

Usage

import lomemo from 'lomemo';

// Let's memoize a function, using the first argument as the key

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

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

// Let's memoize a function, using a custom function to generate the key

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

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

License

MIT © lodash

1.0.1

5 months ago

1.0.0

1 year ago