forked from ehmicky/Notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap-obj.javascript.txt
More file actions
24 lines (20 loc) · 1.52 KB
/
map-obj.javascript.txt
File metadata and controls
24 lines (20 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
┏━━━━━━━━━━━━━┓
┃ 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__