MCPcopy Create free account
hub / github.com/microsoft/SandDance / flattenArray

Function flattenArray

docs/tests/v2/es6/js/sanddance.js:45992–46006  ·  view source on GitHub ↗
(array, filter, map, result)

Source from the content-addressed store, hash-verified

45990
45991
45992function flattenArray(array, filter, map, result) {
45993 var index = -1;
45994
45995 while (++index < array.length) {
45996 var value = array[index];
45997
45998 if (Array.isArray(value)) {
45999 flattenArray(value, filter, map, result);
46000 } else if (filter(value)) {
46001 result.push(map(value));
46002 }
46003 }
46004
46005 return result;
46006}
46007
46008function countVertices(nestedArray) {
46009 var count = 0;

Callers 1

flattenFunction · 0.70

Calls 2

filterFunction · 0.70
mapFunction · 0.70

Tested by

no test coverage detected