Converts an object to another using a namespace path mapping.
Isomorphic: works both in backends and in frontends via e.g. webpack
Isomorphic: works both in backends and in frontends via e.g. webpack
Members
(private, inner, constant) rexs :Object
Cached regexs for internal use
Methods
(inner) compact(oMap) → {Object}
Compacts a mapping (key:value) object into a tree-like structure
Parameters:
Name | Type | Description |
---|---|---|
oMap |
Object | Key-value object to compact |
(private, inner) dotted(aSeg) → {String}
Makes a dotted path from an array of path segments
e.g.
e.g.
['a', 'b', 1, 0, 'c'] => 'a.b.1.0.c'
Parameters:
Name | Type | Description |
---|---|---|
aSeg |
Array | An array of path segments |
(private, inner) intersect(aNs1, aNs2) → {Array}
Gets the intersection of two arrays of path segments
Parameters:
Name | Type | Description |
---|---|---|
aNs1 |
Array | First array to intersect |
aNs2 |
Array | Second array to intersect |
(inner) mapper(oDest, oSrc, oMap, oConfigopt) → {Object}
Performs a mapping with a given object from a data schema to another data schema
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
oDest |
Object | The destination object where the mapped values are applied over | |
oSrc |
Object | The source object | |
oMap |
Object | A key-value hash (mapping) between namespace paths in the source and those in the destination | |
oConfig |
Object |
<optional> |
Optional configuration object with any of the following options:
|
(private, inner) segments(sNs) → {Array}
Gets the array of segments for a JavaScript path
e.g.
e.g.
'a.b.c[1][2].d' => ['a', 'b', 'c', '1', '2', 'd']
Parameters:
Name | Type | Description |
---|---|---|
sNs |
String | A JavaScript (namespace) path |