bare-script 3.8.0 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/library.js +5 -3
- package/package.json +1 -1
package/lib/library.js
CHANGED
|
@@ -82,14 +82,16 @@ const arrayExtendArgs = valueArgsModel([
|
|
|
82
82
|
// $group: Array
|
|
83
83
|
// $doc: Flat an array hierarchy
|
|
84
84
|
// $arg array: The array to flat
|
|
85
|
+
// $arg depth: The maximum depth of the array hierarchy
|
|
85
86
|
// $return: The flated array
|
|
86
87
|
function arrayFlat(args) {
|
|
87
|
-
const [array] = valueArgsValidate(arrayFlatArgs, args);
|
|
88
|
-
return array.flat(
|
|
88
|
+
const [array, depth] = valueArgsValidate(arrayFlatArgs, args);
|
|
89
|
+
return array.flat(depth);
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
const arrayFlatArgs = valueArgsModel([
|
|
92
|
-
{'name': 'array', 'type': 'array'}
|
|
93
|
+
{'name': 'array', 'type': 'array'},
|
|
94
|
+
{'name': 'depth', 'type': 'number', 'integer': true, 'default': 10}
|
|
93
95
|
]);
|
|
94
96
|
|
|
95
97
|
|