Bachir Soussi Chiadmi cefd1c2ad0 updated sys and created publi | 6 anni fa | |
---|---|---|
.. | ||
LICENSE | 7 anni fa | |
README.md | 7 anni fa | |
index.js | 7 anni fa | |
package.json | 6 anni fa |
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%.
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)
Install dev dependencies:
npm i -d && npm test
npm i arr-flatten --save
bower install arr-flatten --save
var flatten = require('arr-flatten');
flatten(['a', ['b', ['c']], 'd', ['e']]);
//=> ['a', 'b', 'c', 'd', 'e']
Jon Schlinkert
Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on March 11, 2015.