MCPcopy Create free account
hub / github.com/PaulTaykalo/objc-dependency-visualizer / flatten

Function flatten

Scripts/ace/worker-javascript.js:1701–1717  ·  view source on GitHub ↗
(input, shallow, strict, startIndex)

Source from the content-addressed store, hash-verified

1699 return _.filter(array, _.identity);
1700 };
1701 var flatten = function(input, shallow, strict, startIndex) {
1702 var output = [], idx = 0;
1703 for (var i = startIndex || 0, length = input && input.length; i < length; i++) {
1704 var value = input[i];
1705 if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {
1706 if (!shallow) value = flatten(value, shallow, strict);
1707 var j = 0, len = value.length;
1708 output.length += len;
1709 while (j < len) {
1710 output[idx++] = value[j++];
1711 }
1712 } else if (!strict) {
1713 output[idx++] = value;
1714 }
1715 }
1716 return output;
1717 };
1718 _.flatten = function(array, shallow) {
1719 return flatten(array, shallow, false);
1720 };

Callers 1

Calls 1

isArrayLikeFunction · 0.85

Tested by

no test coverage detected