MCPcopy
hub / github.com/facebook/react / createCacheNode

Function createCacheNode

packages/react/src/ReactCacheImpl.js:46–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44}
45
46function createCacheNode<T>(): CacheNode<T> {
47 return {
48 s: UNTERMINATED, // status, represents whether the cached computation returned a value or threw an error
49 v: undefined, // value, either the cached result or an error, depending on s
50 o: null, // object cache, a WeakMap where non-primitive arguments are stored
51 p: null, // primitive cache, a regular Map where primitive arguments are stored.
52 };
53}
54
55export function cache<A: Iterable<mixed>, T>(fn: (...A) => T): (...A) => T {
56 return function () {

Callers 1

cacheFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected