Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jajbshjahavahh
GitHub Repository: jajbshjahavahh/Gojo-Satoru
Path: blob/master/node_modules/@hapi/hoek/lib/flatten.js
2593 views
1
'use strict';
2
3
const internals = {};
4
5
6
module.exports = internals.flatten = function (array, target) {
7
8
const result = target || [];
9
10
for (let i = 0; i < array.length; ++i) {
11
if (Array.isArray(array[i])) {
12
internals.flatten(array[i], result);
13
}
14
else {
15
result.push(array[i]);
16
}
17
}
18
19
return result;
20
};
21
22