memoize-one

  • Version 6.0.0
  • Published
  • 35.6 kB
  • No dependencies
  • MIT license

Install

npm i memoize-one
yarn add memoize-one
pnpm add memoize-one

Overview

A memoization library which only remembers the latest invocation

Index

Functions

function memoizeOne

memoizeOne: <TFunc extends (this: any, ...newArgs: any[]) => any>(
resultFn: TFunc,
isEqual?: EqualityFn<TFunc>
) => MemoizedFn<TFunc>;

    Type Aliases

    type EqualityFn

    type EqualityFn<TFunc extends (...args: any[]) => any> = (
    newArgs: Parameters<TFunc>,
    lastArgs: Parameters<TFunc>
    ) => boolean;

      type MemoizedFn

      type MemoizedFn<TFunc extends (this: any, ...args: any[]) => any> = {
      clear: () => void;
      (this: ThisParameterType<TFunc>, ...args: Parameters<TFunc>): ReturnType<TFunc>;
      };

        Package Files (1)

        Dependencies (0)

        No dependencies.

        Dev Dependencies (36)

        Peer Dependencies (0)

        No peer dependencies.

        Badge

        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/memoize-one.

        • Markdown
          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/memoize-one)
        • HTML
          <a href="https://www.jsdocs.io/package/memoize-one"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>