MCPcopy
hub / github.com/ternjs/tern / flatten

Function flatten

doc/demo/underscore.js:424–433  ·  view source on GitHub ↗
(input, shallow, output)

Source from the content-addressed store, hash-verified

422
423 // Internal implementation of a recursive `flatten` function.
424 var flatten = function(input, shallow, output) {
425 each(input, function(value) {
426 if (_.isArray(value)) {
427 shallow ? push.apply(output, value) : flatten(value, shallow, output);
428 } else {
429 output.push(value);
430 }
431 });
432 return output;
433 };
434
435 // Return a completely flattened version of an array.
436 _.flatten = function(array, shallow) {

Callers 1

underscore.jsFile · 0.85

Calls 1

eachFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…