UNPKG
@prelude/function
Version:
latest (0.4.1)
0.4.1
0.4.0
0.3.0
0.2.0
0.1.0
0.0.3
Function module.
@prelude/function
/
mjs
/
memoize.test.js
9 lines
•
283 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
import
*
as
F
from
'./index.js'
;
const
factorial = F.
memoize
(
(
n
) =>
n ===
1
?
1n
:
BigInt
(n) *
factorial
(n -
1
));
test
(
'memoize'
,
() =>
{
expect
(
factorial
(
100
)).
toMatchSnapshot
();
expect
(factorial.
cache
).
toMatchSnapshot
(); });
//# sourceMappingURL=memoize.test.js.map