-
Notifications
You must be signed in to change notification settings - Fork 16
/
map-obj.javascript.txt
26 lines (20 loc) · 2.35 KB
/
map-obj.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
26
MAP-OBJ
ALTERNATIVES ==> # - map-obj (preferred with Node): deep
# - deno map (preferred with Deno unless needs deep): shallow
VERSION ==> #5.0.2
MAPOBJ(OBJ, FUNC(KEY, VAL, OBJ) #Map an OBJ values|keys
->[KEY, VAL[, OBJ2]][, OPTS]) #OPTS:
->OBJ # - deep BOOL (def: false):
# - recursive, from parent to children
# - avoid infinite recursion
# - do not recurse on REGEXP|ERROR|DATE|BLOB, or if OBJ2.shouldRecurse false
# - ARRs:
# - are mapped as a whole by their first non-ARR parent, like other properties
# - their non-OBJ children are not individually mapped, but their ARR|OBJ children are recursed
# - target OBJ (def: new {}):
# - OBJ to mutate and return
# - not used when top-level is ARR
#Can return mapObjectSkip (named export) instead of [KEY, VAL[, OBJ2]], to filter a specific property
#Always remove __proto__