(array, output)
| 19 | * @return {array} The flattened output array. |
| 20 | */ |
| 21 | var Flatten = function (array, output) |
| 22 | { |
| 23 | if (output === undefined) { output = []; } |
| 24 | |
| 25 | for (var i = 0; i < array.length; i++) |
| 26 | { |
| 27 | if (Array.isArray(array[i])) |
| 28 | { |
| 29 | Flatten(array[i], output); |
| 30 | } |
| 31 | else |
| 32 | { |
| 33 | output.push(array[i]); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | return output; |
| 38 | }; |
| 39 | |
| 40 | module.exports = Flatten; |
no outgoing calls
no test coverage detected
searching dependent graphs…