time-to-botec/squiggle/node_modules/@stdlib/utils/deep-pluck/docs/repl.txt
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

51 lines
1.0 KiB
Plaintext

{{alias}}( arr, path[, options] )
Extracts a nested property value from each element of an object array.
If a key path does not exist, the function sets the plucked value as
`undefined`.
Extracted values are not cloned.
Parameters
----------
arr: Array
Source array.
path: string|Array
Key path.
options: Object (optional)
Options.
options.copy: boolean (optional)
Boolean indicating whether to return a new data structure. Default:
true.
options.sep: string (optional)
Key path separator. Default: '.'.
Returns
-------
out: Array
Destination array.
Examples
--------
> var arr = [
... { 'a': { 'b': { 'c': 1 } } },
... { 'a': { 'b': { 'c': 2 } } }
... ];
> var out = {{alias}}( arr, 'a.b.c' )
[ 1, 2 ]
> arr = [
... { 'a': [ 0, 1, 2 ] },
... { 'a': [ 3, 4, 5 ] }
... ];
> out = {{alias}}( arr, [ 'a', 1 ] )
[ 1, 4 ]
See Also
--------