deno.land / x / rambda@v9.1.1 / source / memoizeWith.js

memoizeWith.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
export function memoizeWith(keyGen, fn){ if (arguments.length === 1){ return _fn => memoizeWith(keyGen, _fn) } const cache = new Map()
return function (){ const key = keyGen.apply(this, arguments) if (!cache.has(key)){ cache.set(key, fn.apply(this, arguments)) }
return cache.get(key) }}
rambda

Version Info

Tagged at
2 months ago