(array, filter, map, result)
| 45990 | |
| 45991 | |
| 45992 | function 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 | |
| 46008 | function countVertices(nestedArray) { |
| 46009 | var count = 0; |