-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathfast-memoize.javascript.txt
25 lines (21 loc) · 1.47 KB
/
fast-memoize.javascript.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
┏━━━━━━━━━━━━━━━━━━┓
┃ FAST-MEMOIZE ┃
┗━━━━━━━━━━━━━━━━━━┛
ALTERNATIVES ==> #See moize
VERSION ==> #2.5.1
FASTMEMOIZE(FUNC(...)[, OPTS]) #OPTS:
->FUNC # - serializer(...ARGS)->KEY_VAL
# - transform FUNC input
# - not called if ARG is scalar (NUM|BOOL|STR|null) and ARGS.length === 1
# - since variadic arguments are not included in ARGS.length, if they are used,
# should pass OPTS.strategy FASTMEMOIZE.strategies.variadic, otherwise they will
# not be included
# - def: JSON.stringify()
# - cache OBJ:
# - create()->CACHE
# - with CACHE:
# - get(KEY)->VAL
# - set(KEY)->VAL
# - has(KEY)->BOOL
# - def: in-memory simple OBJ cache, i.e. keys must be strings
#Does not memoize "this", only arguments