UNPKG
@discord-user-card/core
Version:
latest (0.0.9)
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
The core behind the Discord User Card project.
@discord-user-card/core
/
lib
/
util
/
memoize.js
10 lines
•
274 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
export
function
memoize
(
fn
) {
const
cache =
new
Map
();
return
(
(
...args
) =>
{
const
key =
JSON
.
stringify
(args);
if
(!cache.
has
(key)) cache.
set
(key,
fn
(...args));
return
cache.
get
(key); }); }
//# sourceMappingURL=memoize.js.map