Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@hapi/hoek/lib/flatten.js
1126 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 (const entry of array) {
11
if (Array.isArray(entry)) {
12
internals.flatten(entry, result);
13
}
14
else {
15
result.push(entry);
16
}
17
}
18
19
return result;
20
};
21
22