{"id":13495530,"url":"https://github.com/alexreardon/memoize-one","last_synced_at":"2025-05-13T17:05:30.079Z","repository":{"id":16873177,"uuid":"80793307","full_name":"alexreardon/memoize-one","owner":"alexreardon","description":"A memoization library which only remembers the latest invocation","archived":false,"fork":false,"pushed_at":"2023-01-08T21:07:38.000Z","size":1512,"stargazers_count":2960,"open_issues_count":16,"forks_count":80,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-01T14:45:09.369Z","etag":null,"topics":["javascript","memoization","memoize","performance"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexreardon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-03T03:22:45.000Z","updated_at":"2025-04-27T20:29:11.000Z","dependencies_parsed_at":"2023-01-13T20:00:18.060Z","dependency_job_id":null,"html_url":"https://github.com/alexreardon/memoize-one","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexreardon%2Fmemoize-one","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexreardon%2Fmemoize-one/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexreardon%2Fmemoize-one/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexreardon%2Fmemoize-one/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexreardon","download_url":"https://codeload.github.com/alexreardon/memoize-one/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252455696,"owners_count":21750513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","memoization","memoize","performance"],"created_at":"2024-07-31T19:01:35.635Z","updated_at":"2025-05-13T17:05:30.035Z","avatar_url":"https://github.com/alexreardon.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Utilities","目录","Framework agnostic packages"],"sub_categories":["React Components","General utilities"],"readme":"# memoize-one\n\nA memoization library that only caches the result of the most recent arguments.\n\n[![npm](https://img.shields.io/npm/v/memoize-one.svg)](https://www.npmjs.com/package/memoize-one)\n![types](https://img.shields.io/badge/types-typescript%20%7C%20flow-blueviolet)\n[![minzip](https://img.shields.io/bundlephobia/minzip/memoize-one.svg)](https://www.npmjs.com/package/memoize-one)\n[![Downloads per month](https://img.shields.io/npm/dm/memoize-one.svg)](https://www.npmjs.com/package/memoize-one)\n\n## Rationale\n\nUnlike other memoization libraries, `memoize-one` only remembers the latest arguments and result. No need to worry about cache busting mechanisms such as `maxAge`, `maxSize`, `exclusions` and so on, which can be prone to memory leaks. A function memoized with `memoize-one` simply remembers the last arguments, and if the memoized function is next called with the same arguments then it returns the previous result.\n\n\u003e For working with promises, [@Kikobeats](https://github.com/Kikobeats) has built [async-memoize-one](https://github.com/microlinkhq/async-memoize-one).\n\n## Usage\n\n```js\n// memoize-one uses the default import\nimport memoizeOne from 'memoize-one';\n\nfunction add(a, b) {\n  return a + b;\n}\nconst memoizedAdd = memoizeOne(add);\n\nmemoizedAdd(1, 2);\n// add function: is called\n// [new value returned: 3]\n\nmemoizedAdd(1, 2);\n// add function: not called\n// [cached result is returned: 3]\n\nmemoizedAdd(2, 3);\n// add function: is called\n// [new value returned: 5]\n\nmemoizedAdd(2, 3);\n// add function: not called\n// [cached result is returned: 5]\n\nmemoizedAdd(1, 2);\n// add function: is called\n// [new value returned: 3]\n// 👇\n// While the result of `add(1, 2)` was previously cached\n// `(1, 2)` was not the *latest* arguments (the last call was `(2, 3)`)\n// so the previous cached result of `(1, 3)` was lost\n```\n\n## Installation\n\n```bash\n# yarn\nyarn add memoize-one\n\n# npm\nnpm install memoize-one --save\n```\n\n## Function argument equality\n\nBy default, we apply our own _fast_ and _relatively naive_ equality function to determine whether the arguments provided to your function are equal. You can see the full code here: [are-inputs-equal.ts](https://github.com/alexreardon/memoize-one/blob/master/src/are-inputs-equal.ts).\n\n(By default) function arguments are considered equal if:\n\n1. there is same amount of arguments\n2. each new argument has strict equality (`===`) with the previous argument\n3. **[special case]** if two arguments are not `===` and they are both `NaN` then the two arguments are treated as equal\n\nWhat this looks like in practice:\n\n```js\nimport memoizeOne from 'memoize-one';\n\n// add all numbers provided to the function\nconst add = (...args = []) =\u003e\n  args.reduce((current, value) =\u003e {\n    return current + value;\n  }, 0);\nconst memoizedAdd = memoizeOne(add);\n```\n\n\u003e 1. there is same amount of arguments\n\n```js\nmemoizedAdd(1, 2);\n// the amount of arguments has changed, so add function is called\nmemoizedAdd(1, 2, 3);\n```\n\n\u003e 2. new arguments have strict equality (`===`) with the previous argument\n\n```js\nmemoizedAdd(1, 2);\n// each argument is `===` to the last argument, so cache is used\nmemoizedAdd(1, 2);\n// second argument has changed, so add function is called again\nmemoizedAdd(1, 3);\n// the first value is not `===` to the previous first value (1 !== 3)\n// so add function is called again\nmemoizedAdd(3, 1);\n```\n\n\u003e 3. **[special case]** if the arguments are not `===` and they are both `NaN` then the argument is treated as equal\n\n```js\nmemoizedAdd(NaN);\n// Even though NaN !== NaN these arguments are\n// treated as equal as they are both `NaN`\nmemoizedAdd(NaN);\n```\n\n## Custom equality function\n\nYou can also pass in a custom function for checking the equality of two sets of arguments\n\n```js\nconst memoized = memoizeOne(fn, isEqual);\n```\n\nAn equality function should return `true` if the arguments are equal. If `true` is returned then the wrapped function will not be called.\n\n**Tip**: A custom equality function needs to compare `Arrays`. The `newArgs` array will be a new reference every time so a simple `newArgs === lastArgs` will always return `false`.\n\nEquality functions are not called if the `this` context of the function has changed (see below).\n\nHere is an example that uses a [lodash.isEqual](https://lodash.com/docs/4.17.15#isEqual) deep equal equality check\n\n\u003e `lodash.isequal` correctly handles deep comparing two arrays\n\n```js\nimport memoizeOne from 'memoize-one';\nimport isDeepEqual from 'lodash.isequal';\n\nconst identity = (x) =\u003e x;\n\nconst shallowMemoized = memoizeOne(identity);\nconst deepMemoized = memoizeOne(identity, isDeepEqual);\n\nconst result1 = shallowMemoized({ foo: 'bar' });\nconst result2 = shallowMemoized({ foo: 'bar' });\n\nresult1 === result2; // false - different object reference\n\nconst result3 = deepMemoized({ foo: 'bar' });\nconst result4 = deepMemoized({ foo: 'bar' });\n\nresult3 === result4; // true - arguments are deep equal\n```\n\nThe equality function needs to conform to the `EqualityFn` `type`:\n\n```ts\n// TFunc is the function being memoized\ntype EqualityFn\u003cTFunc extends (...args: any[]) =\u003e any\u003e = (\n  newArgs: Parameters\u003cTFunc\u003e,\n  lastArgs: Parameters\u003cTFunc\u003e,\n) =\u003e boolean;\n\n// You can import this type\nimport type { EqualityFn } from 'memoize-one';\n```\n\nThe `EqualityFn` type allows you to create equality functions that are extremely typesafe. You are welcome to provide your own less type safe equality functions.\n\nHere are some examples of equality functions which are ordered by most type safe, to least type safe:\n\n\u003cdetails\u003e\n  \u003csummary\u003eExample equality function types\u003c/summary\u003e\n  \u003cp\u003e\n\n```ts\n// the function we are going to memoize\nfunction add(first: number, second: number): number {\n  return first + second;\n}\n\n// Some options for our equality function\n// ↑ stronger types\n// ↓ weaker types\n\n// ✅ exact parameters of `add`\n{\n  const isEqual = function (first: Parameters\u003ctypeof add\u003e, second: Parameters\u003ctypeof add\u003e) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ✅ tuple of the correct types\n{\n  const isEqual = function (first: [number, number], second: [number, number]) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ❌ tuple of incorrect types\n{\n  const isEqual = function (first: [number, string], second: [number, number]) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().not.toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ✅ array of the correct types\n{\n  const isEqual = function (first: number[], second: number[]) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ❌ array of incorrect types\n{\n  const isEqual = function (first: string[], second: number[]) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().not.toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ✅ tuple of 'unknown'\n{\n  const isEqual = function (first: [unknown, unknown], second: [unknown, unknown]) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ❌ tuple of 'unknown' of incorrect length\n{\n  const isEqual = function (first: [unknown, unknown, unknown], second: [unknown, unknown]) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().not.toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ✅ array of 'unknown'\n{\n  const isEqual = function (first: unknown[], second: unknown[]) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ✅ spread of 'unknown'\n{\n  const isEqual = function (...first: unknown[]) {\n    return !!first;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ✅ tuple of 'any'\n{\n  const isEqual = function (first: [any, any], second: [any, any]) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ❌ tuple of 'any' or incorrect size\n{\n  const isEqual = function (first: [any, any, any], second: [any, any]) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().not.toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ✅ array of 'any'\n{\n  const isEqual = function (first: any[], second: any[]) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ✅ two arguments of type any\n{\n  const isEqual = function (first: any, second: any) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ✅ a single argument of type any\n{\n  const isEqual = function (first: any) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n\n// ✅ spread of any type\n{\n  const isEqual = function (...first: any[]) {\n    return true;\n  };\n  expectTypeOf\u003ctypeof isEqual\u003e().toMatchTypeOf\u003cEqualityFn\u003ctypeof add\u003e\u003e();\n}\n```\n\n  \u003c/p\u003e\n\u003c/details\u003e\n\n## `this`\n\n### `memoize-one` correctly respects `this` control\n\nThis library takes special care to maintain, and allow control over the the `this` context for **both** the original function being memoized as well as the returned memoized function. Both the original function and the memoized function's `this` context respect [all the `this` controlling techniques](https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch2.md):\n\n- new bindings (`new`)\n- explicit binding (`call`, `apply`, `bind`);\n- implicit binding (call site: `obj.foo()`);\n- default binding (`window` or `undefined` in `strict mode`);\n- fat arrow binding (binding to lexical `this`)\n- ignored this (pass `null` as `this` to explicit binding)\n\n### Changes to `this` is considered an argument change\n\nChanges to the running context (`this`) of a function can result in the function returning a different value even though its arguments have stayed the same:\n\n```js\nfunction getA() {\n  return this.a;\n}\n\nconst temp1 = {\n  a: 20,\n};\nconst temp2 = {\n  a: 30,\n};\n\ngetA.call(temp1); // 20\ngetA.call(temp2); // 30\n```\n\nTherefore, in order to prevent against unexpected results, `memoize-one` takes into account the current execution context (`this`) of the memoized function. If `this` is different to the previous invocation then it is considered a change in argument. [further discussion](https://github.com/alexreardon/memoize-one/issues/3).\n\nGenerally this will be of no impact if you are not explicity controlling the `this` context of functions you want to memoize with [explicit binding](https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch2.md#explicit-binding) or [implicit binding](https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch2.md#implicit-binding). `memoize-One` will detect when you are manipulating `this` and will then consider the `this` context as an argument. If `this` changes, it will re-execute the original function even if the arguments have not changed.\n\n## Clearing the memoization cache\n\nA `.clear()` property is added to memoized functions to allow you to clear it's memoization cache.\n\nThis is helpful if you want to:\n\n- Release memory\n- Allow the result function to be called again without having to change arguments\n\n```ts\nimport memoizeOne from 'memoize-one';\n\nfunction add(a: number, b: number): number {\n  return a + b;\n}\n\nconst memoizedAdd = memoizeOne(add);\n\n// first call - not memoized\nconst first = memoizedAdd(1, 2);\n\n// second call - cache hit (result function not called)\nconst second = memoizedAdd(1, 2);\n\n// 👋 clearing memoization cache\nmemoizedAdd.clear();\n\n// third call - not memoized (cache was cleared)\nconst third = memoizedAdd(1, 2);\n```\n\n## When your result function `throw`s\n\n\u003e There is no caching when your result function throws\n\nIf your result function `throw`s then the memoized function will also throw. The throw will not break the memoized functions existing argument cache. It means the memoized function will pretend like it was never called with arguments that made it `throw`.\n\n```js\nconst canThrow = (name: string) =\u003e {\n  console.log('called');\n  if (name === 'throw') {\n    throw new Error(name);\n  }\n  return { name };\n};\n\nconst memoized = memoizeOne(canThrow);\n\nconst value1 = memoized('Alex');\n// result function called: console.log =\u003e 'called'\n\nconst value2 = memoized('Alex');\n// result function not called (cache hit)\n\nconsole.log(value1 === value2);\n// console.log =\u003e true\n\ntry {\n  memoized('throw');\n  // console.log =\u003e 'called'\n} catch (e) {\n  firstError = e;\n}\n\ntry {\n  memoized('throw');\n  // console.log =\u003e 'called'\n  // the result function was called again even though it was called twice\n  // with the 'throw' string\n} catch (e) {\n  secondError = e;\n}\n\nconsole.log(firstError !== secondError);\n// console.log =\u003e true\n\nconst value3 = memoized('Alex');\n// result function not called as the original memoization cache has not been busted\n\nconsole.log(value1 === value3);\n// console.log =\u003e true\n```\n\n## Function properties\n\nFunctions memoized with `memoize-one` do not preserve any properties on the function object.\n\n\u003e This behaviour is correctly reflected in the TypeScript types\n\n```ts\nimport memoizeOne from 'memoize-one';\n\nfunction add(a, b) {\n  return a + b;\n}\nadd.hello = 'hi';\n\nconsole.log(typeof add.hello); // string\n\nconst memoized = memoizeOne(add);\n\n// hello property on the `add` was not preserved\nconsole.log(typeof memoized.hello); // undefined\n```\n\n\u003e If you feel strongly that `memoize-one` _should_ preserve function properties, please raise an issue. This decision was made in order to keep `memoize-one` as light as possible.\n\nFor _now_, the `.length` property of a function is not preserved on the memoized function\n\n```ts\nimport memoizeOne from 'memoize-one';\n\nfunction add(a, b) {\n  return a + b;\n}\n\nconsole.log(add.length); // 2\n\nconst memoized = memoizeOne(add);\n\nconsole.log(memoized.length); // 0\n```\n\nThere is no (great) way to correctly set the `.length` property of the memoized function while also supporting ie11. Once we [remove ie11 support](https://github.com/alexreardon/memoize-one/issues/125) then we plan on setting the `.length` property of the memoized function to match the original function\n\n[→ discussion](https://github.com/alexreardon/memoize-one/pull/124).\n\n## Memoized function `type`\n\nThe resulting function you get back from `memoize-one` has _almost_ the same `type` as the function that you are memoizing\n\n```ts\ndeclare type MemoizedFn\u003cTFunc extends (this: any, ...args: any[]) =\u003e any\u003e = {\n  clear: () =\u003e void;\n  (this: ThisParameterType\u003cTFunc\u003e, ...args: Parameters\u003cTFunc\u003e): ReturnType\u003cTFunc\u003e;\n};\n```\n\n- the same call signature as the function being memoized\n- a `.clear()` function property added\n- other function object properties on `TFunc` as not carried over\n\nYou are welcome to use the `MemoizedFn` generic directly from `memoize-one` if you like:\n\n```ts\nimport memoize, { MemoizedFn } from 'memoize-one';\nimport isDeepEqual from 'lodash.isequal';\nimport { expectTypeOf } from 'expect-type';\n\n// Takes any function: TFunc, and returns a Memoized\u003cTFunc\u003e\nfunction withDeepEqual\u003cTFunc extends (...args: any[]) =\u003e any\u003e(fn: TFunc): MemoizedFn\u003cTFunc\u003e {\n  return memoize(fn, isDeepEqual);\n}\n\nfunction add(first: number, second: number): number {\n  return first + second;\n}\n\nconst memoized = withDeepEqual(add);\n\nexpectTypeOf\u003ctypeof memoized\u003e().toEqualTypeOf\u003cMemoizedFn\u003ctypeof add\u003e\u003e();\n```\n\nIn this specific example, this type would have been correctly inferred too\n\n```ts\nimport memoize, { MemoizedFn } from 'memoize-one';\nimport isDeepEqual from 'lodash.isequal';\nimport { expectTypeOf } from 'expect-type';\n\n// return type of MemoizedFn\u003cTFunc\u003e is inferred\nfunction withDeepEqual\u003cTFunc extends (...args: any[]) =\u003e any\u003e(fn: TFunc) {\n  return memoize(fn, isDeepEqual);\n}\n\nfunction add(first: number, second: number): number {\n  return first + second;\n}\n\nconst memoized = withDeepEqual(add);\n\n// type test still passes\nexpectTypeOf\u003ctypeof memoized\u003e().toEqualTypeOf\u003cMemoizedFn\u003ctypeof add\u003e\u003e();\n```\n\n## Performance 🚀\n\n### Tiny\n\n`memoize-one` is super lightweight at [![min](https://img.shields.io/bundlephobia/min/memoize-one.svg?label=)](https://www.npmjs.com/package/memoize-one) minified and [![minzip](https://img.shields.io/bundlephobia/minzip/memoize-one.svg?label=)](https://www.npmjs.com/package/memoize-one) gzipped. (`1KB` = `1,024 Bytes`)\n\n### Extremely fast\n\n`memoize-one` performs better or on par with than other popular memoization libraries for the purpose of remembering the latest invocation.\n\nThe comparisons are not exhaustive and are primarily to show that `memoize-one` accomplishes remembering the latest invocation really fast. There is variability between runs. The benchmarks do not take into account the differences in feature sets, library sizes, parse time, and so on.\n\n\u003cdetails\u003e\n  \u003csummary\u003eExpand for results\u003c/summary\u003e\n  \u003cp\u003e\n\nnode version `16.11.1`\n\nYou can run this test in the repo by:\n\n1. Add `\"type\": \"module\"` to the `package.json` (why is things so hard)\n2. Run `yarn perf:library-comparison`\n\n**no arguments**\n\n| Position | Library                                      | Operations per second |\n| -------- | -------------------------------------------- | --------------------- |\n| 1        | memoize-one                                  | 80,112,981            |\n| 2        | moize                                        | 72,885,631            |\n| 3        | memoizee                                     | 35,550,009            |\n| 4        | mem (JSON.stringify strategy)                | 4,610,532             |\n| 5        | lodash.memoize (JSON.stringify key resolver) | 3,708,945             |\n| 6        | no memoization                               | 505                   |\n| 7        | fast-memoize                                 | 504                   |\n\n**single primitive argument**\n\n| Position | Library                                      | Operations per second |\n| -------- | -------------------------------------------- | --------------------- |\n| 1        | fast-memoize                                 | 45,482,711            |\n| 2        | moize                                        | 34,810,659            |\n| 3        | memoize-one                                  | 29,030,828            |\n| 4        | memoizee                                     | 23,467,065            |\n| 5        | mem (JSON.stringify strategy)                | 3,985,223             |\n| 6        | lodash.memoize (JSON.stringify key resolver) | 3,369,297             |\n| 7        | no memoization                               | 507                   |\n\n**single complex argument**\n\n| Position | Library                                      | Operations per second |\n| -------- | -------------------------------------------- | --------------------- |\n| 1        | moize                                        | 27,660,856            |\n| 2        | memoize-one                                  | 22,407,916            |\n| 3        | memoizee                                     | 19,546,835            |\n| 4        | mem (JSON.stringify strategy)                | 2,068,038             |\n| 5        | lodash.memoize (JSON.stringify key resolver) | 1,911,335             |\n| 6        | fast-memoize                                 | 1,633,855             |\n| 7        | no memoization                               | 504                   |\n\n**multiple primitive arguments**\n\n| Position | Library                                      | Operations per second |\n| -------- | -------------------------------------------- | --------------------- |\n| 1        | moize                                        | 22,366,497            |\n| 2        | memoize-one                                  | 17,241,995            |\n| 3        | memoizee                                     | 9,789,442             |\n| 4        | mem (JSON.stringify strategy)                | 3,065,328             |\n| 5        | lodash.memoize (JSON.stringify key resolver) | 2,663,599             |\n| 6        | fast-memoize                                 | 1,219,548             |\n| 7        | no memoization                               | 504                   |\n\n**multiple complex arguments**\n\n| Position | Library                                      | Operations per second |\n| -------- | -------------------------------------------- | --------------------- |\n| 1        | moize                                        | 21,788,081            |\n| 2        | memoize-one                                  | 17,321,248            |\n| 3        | memoizee                                     | 9,595,420             |\n| 4        | lodash.memoize (JSON.stringify key resolver) | 873,283               |\n| 5        | mem (JSON.stringify strategy)                | 850,779               |\n| 6        | fast-memoize                                 | 687,863               |\n| 7        | no memoization                               | 504                   |\n\n**multiple complex arguments (spreading arguments)**\n\n| Position | Library                                      | Operations per second |\n| -------- | -------------------------------------------- | --------------------- |\n| 1        | moize                                        | 21,701,537            |\n| 2        | memoizee                                     | 19,463,942            |\n| 3        | memoize-one                                  | 17,027,544            |\n| 4        | lodash.memoize (JSON.stringify key resolver) | 887,816               |\n| 5        | mem (JSON.stringify strategy)                | 849,244               |\n| 6        | fast-memoize                                 | 691,512               |\n| 7        | no memoization                               | 504                   |\n\n  \u003c/p\u003e\n\u003c/details\u003e\n\n## Code health 👍\n\n- Tested with all built in [JavaScript types](https://github.com/getify/You-Dont-Know-JS/blob/1st-ed/types%20%26%20grammar/ch1.md)\n- Written in `Typescript`\n- Correct typing for `Typescript` and `flow` type systems\n- No dependencies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexreardon%2Fmemoize-one","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexreardon%2Fmemoize-one","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexreardon%2Fmemoize-one/lists"}