lomemo
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i lomemo

Weekly Downloads

1

Version

1.0.0

License

none

Unpacked Size

7.76 kB

Total Files

12

Last publish

Collaborators

  • fabiospampinato