init
This commit is contained in:
8
mc_test/node_modules/@emotion/memoize/src/index.ts
generated
vendored
Executable file
8
mc_test/node_modules/@emotion/memoize/src/index.ts
generated
vendored
Executable file
@ -0,0 +1,8 @@
|
||||
export default function memoize<V>(fn: (arg: string) => V): (arg: string) => V {
|
||||
const cache: Record<string, V> = Object.create(null)
|
||||
|
||||
return (arg: string) => {
|
||||
if (cache[arg] === undefined) cache[arg] = fn(arg)
|
||||
return cache[arg]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user