UNPKG

@nknahom/lotide

Version:

Lotide is mini clone of the Lodash (https://lodash.com) library for learning JavaScript. What is Lodash? Lodash is a library that makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc.

16 lines (14 loc) 280 B
const flatten = function (array) { let flatArray = []; for (let item of array) { if (Array.isArray(item)) { for (let i of item) { flatArray.push(i); } } else { flatArray.push(item); } } return flatArray; }; module.exports = flatten;