dev-flatten
v1.0.3
Published
This package is about flattening an arrray
Downloads
1
Readme
dev-flatten
Convert a nested array into a single array
Installation
# using npm
npm install dev-flatten
# using yarn
yarn add dev-flatten
Usage
# using require
const { flatten } = require('dev-flatten');
# using import
import { flatten } from 'dev-flatten';
Example
const arr = [1, 2, 3, [1, 2], [1, [2, [2, 3]]]];
console.log(flatten(arr));
output = [1, 2, 3, 1, 2, 1, 2, 2, 3];