JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17868210
  • Score
    100M100P100Q238169F
  • License MIT

Recursively flatten an array or arrays.

Package Exports

  • arr-flatten

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (arr-flatten) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

arr-flatten NPM version NPM monthly downloads Linux Build Status Windows Build Status

Recursively flatten an array or arrays.

Install

Install with npm:

$ npm install --save arr-flatten

Install with yarn:

$ yarn add arr-flatten

Install

Install with bower

$ bower install arr-flatten --save

Usage

var flatten = require('arr-flatten');

flatten(['a', ['b', ['c']], 'd', ['e']]);
//=> ['a', 'b', 'c', 'd', 'e']

Benchmarks

This library versus array-flatten, on April 14, 2017:

#1: large.js
  arr-flatten.js x 487,030 ops/sec ±0.67% (92 runs sampled)
  array-flatten.js x 347,020 ops/sec ±0.57% (98 runs sampled)

#2: medium.js
  arr-flatten.js x 1,914,516 ops/sec ±0.76% (94 runs sampled)
  array-flatten.js x 1,391,661 ops/sec ±0.63% (96 runs sampled)

#3: small.js
  arr-flatten.js x 5,158,980 ops/sec ±0.85% (94 runs sampled)
  array-flatten.js x 3,683,173 ops/sec ±0.79% (97 runs sampled)

Run the benchmarks

$ npm run benchmarks

Why another flatten utility?

I wanted the fastest implementation I could find, with implementation choices that should work for 95% of use cases, but no cruft to cover the other 5%.

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.5.0, on April 14, 2017.