arr-flatten 1.0.1

Recursively flatten an array or arrays. This is the fastest implementation of array flatten.

Homepage: https://github.com/jonschlinkert/arr-flatten

Platform: npm

Language: JavaScript

License: MIT

Keywords: arr, array, elements, flat, flatten, nested, recurse, recursive, recursively

View on registry: https://www.npmjs.com/package/arr-flatten

Direct download link: https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.0.1.tgz

Install: npm install [email protected]


arr-flatten NPM version Build Status

Recursively flatten an array or arrays. This is the fastest implementation of array flatten.

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%.

Run benchmarks

npm run benchmarks

Benchmark results comparing this library to array-flatten:

#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 tests

Install dev dependencies:

npm i -d && npm test

Install with npm

npm i arr-flatten --save

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']

Author

Jon Schlinkert

License

Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb-cli on March 11, 2015.

Releases

  • 1.0.1 - March 11, 2015 04:28
  • 1.0.0 - January 20, 2015 03:35
  • 0.2.1 - November 09, 2014 10:07
  • 0.2.0 - October 28, 2014 18:48
  • 0.1.0 - September 26, 2014 01:43

Project Statistics

SourceRank 18
Dependencies 0
Dependent projects 72
Dependent repositories 12K
Total releases 5
Latest release
First release
Stars 14
Forks 2
Watchers 6
Contributors 1
Repo Size: 160 KB

Top Contributors See all

Jon Schlinkert

Something wrong with this page? Make a suggestion

Export .ABOUT file for this library

Last synced: 2016-10-13 17:51:37 UTC

Login to resync this project