UNPKG

@stewartmac/lotide

Version:

Modular collection of functions that operate on data, namely Arrays and Objects.

15 lines (14 loc) 324 B
const flatten = function(inputArray) { const flatArray = []; for (let element of inputArray) { if (Array.isArray(element)) { for (let innerElement of element) { flatArray.push(innerElement); } } else { flatArray.push(element); } } return flatArray; }; module.exports = flatten;