Last active
January 20, 2019 11:53
-
-
Save ufocoder/3ea23f8414c0cf0320f96134023640b5 to your computer and use it in GitHub Desktop.
Revisions
-
ufocoder revised this gist
Jan 20, 2019 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,6 @@ const memoized = fn => { if (!cache.has(args)) { cache.set(args, fn(...args)) } return cache.get(args) } } -
ufocoder created this gist
Jan 20, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ const memoized = fn => { const cache = new WeakMap() return (...args) => { if (!cache.has(args)) { cache.set(args, fn(...args)) } return cache.get(args) } }