MCPcopy Index your code
hub / github.com/nodejs/node / flatten

Function flatten

test/fixtures/snapshot/typescript.js:676–690  ·  view source on GitHub ↗

* Flattens an array containing a mix of array or non-array elements. * * @param array The array to flatten.

(array)

Source from the content-addressed store, hash-verified

674 * @param array The array to flatten.
675 */
676 function flatten(array) {
677 var result = [];
678 for (var _i = 0, array_2 = array; _i < array_2.length; _i++) {
679 var v = array_2[_i];
680 if (v) {
681 if (isArray(v)) {
682 addRange(result, v);
683 }
684 else {
685 result.push(v);
686 }
687 }
688 }
689 return result;
690 }
691 ts.flatten = flatten;
692 /**
693 * Maps an array. If the mapped value is an array, it is spread into the result.

Callers

nothing calls this directly

Calls 3

addRangeFunction · 0.85
isArrayFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…