mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-24 21:50:00 +08:00
Add node modules and compiled JavaScript from main (#172)
Co-authored-by: Oliver King <oking3@uncc.edu>
This commit is contained in:
committed by
GitHub
parent
ee3c5aed75
commit
08d466b6ab
+33
@@ -0,0 +1,33 @@
|
||||
var _getLength = require('./_getLength.js');
|
||||
var _isArrayLike = require('./_isArrayLike.js');
|
||||
var isArray = require('./isArray.js');
|
||||
var isArguments = require('./isArguments.js');
|
||||
|
||||
// Internal implementation of a recursive `flatten` function.
|
||||
function flatten(input, depth, strict, output) {
|
||||
output = output || [];
|
||||
if (!depth && depth !== 0) {
|
||||
depth = Infinity;
|
||||
} else if (depth <= 0) {
|
||||
return output.concat(input);
|
||||
}
|
||||
var idx = output.length;
|
||||
for (var i = 0, length = _getLength(input); i < length; i++) {
|
||||
var value = input[i];
|
||||
if (_isArrayLike(value) && (isArray(value) || isArguments(value))) {
|
||||
// Flatten current level of array or arguments object.
|
||||
if (depth > 1) {
|
||||
flatten(value, depth - 1, strict, output);
|
||||
idx = output.length;
|
||||
} else {
|
||||
var j = 0, len = value.length;
|
||||
while (j < len) output[idx++] = value[j++];
|
||||
}
|
||||
} else if (!strict) {
|
||||
output[idx++] = value;
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
module.exports = flatten;
|
||||
Reference in New Issue
Block a user