1d

1.0.0 • Public • Published
1D

1D

Make multi-dimensional arrays as flat as a pancake

Installation

npm install 1d

Usage

const flatten = require('1d');
 
flatten( [['a'], 'b', ['c', ['d']]] );
// ['a', 'b', 'c', 'd']

OBS: This is a built-in feature from Node.js 11.15.0 and up. Check out Array.prototype.flat

API

oned(arr, res)

Flatten an array into a sweet 1D array

arr

Type: Array

Input array to flatten

res

Type: Array
Default: []

Initial array.

Note: The inital array is not being flattened

License

MIT © Terkel Gjervig

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    1
  • 0.1.1
    7
  • 0.1.0
    0

Package Sidebar

Install

npm i 1d

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

3.39 kB

Total Files

4

Last publish

Collaborators

  • terkelg