Skip to main content
Module

x/rambda/source/flatten.js

Faster and smaller alternative to Ramda
Latest
File
import { isArray } from './_internals/isArray.js'
export function flatten(list, input){ const willReturn = input === undefined ? [] : input
for (let i = 0; i < list.length; i++){ if (isArray(list[ i ])){ flatten(list[ i ], willReturn) } else { willReturn.push(list[ i ]) } }
return willReturn}