Socket
Socket
Sign inDemoInstall

1d

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    1d

Make multi-dimensional arrays as flat as a pancake


Version published
Weekly downloads
8
decreased by-27.27%
Maintainers
1
Install size
4.07 kB
Created
Weekly downloads
 

Readme

Source
1D

1D

version travis downloads
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

Keywords

FAQs

Last updated on 18 Mar 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc