Namespace default

Description

memoize a function based its arguments passed, potentially improving runtime performance

Example

import moize from 'moize';

// standard implementation
const fn = (foo, bar) => `${foo} ${bar}`;
const memoizedFn = moize(fn);

// implementation with options
const fn = async (id) => get(`http://foo.com/${id}`);
const memoizedFn = moize(fn, {isPromise: true, maxSize: 5});

// implementation with convenience methods
const Foo = ({foo}) => <div>{foo}</div>;
const MemoizedFoo = moize.react(Foo);

Param

the function to memoized, or a list of options when currying

Param

the options to apply

Returns

the memoized function

Index

Variables

Functions

Generated using TypeDoc