Skip to content

Commit

Permalink
v0.2.1
Browse files Browse the repository at this point in the history
  - minor edits, export a named function
  • Loading branch information
jonschlinkert committed Nov 9, 2014
1 parent ea237d1 commit 8adf6d2
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions README.md
@@ -1,6 +1,5 @@
# arr-flatten [![NPM version](https://badge.fury.io/js/arr-flatten.svg)](http://badge.fury.io/js/arr-flatten)


> Recursively flatten an array or arrays. This is the fastest implementation of array flatten.
Why another flatten utility? Because this one is faster.
Expand Down Expand Up @@ -52,4 +51,4 @@ Released under the MIT license

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 28, 2014._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 09, 2014._
File renamed without changes.
2 changes: 1 addition & 1 deletion benchmark/fixtures/medium.js
@@ -1 +1 @@
module.exports = [['a', ['b', ['k', ['a', ['b', ['c']], ['a', ['x', ['c'], ['a', ['x', ['k']]], ['d', ['z']]]], ['d', ['m']]], ['d', ['e']]]]], ['d', ['e']]];
module.exports = [[['a', ['b', ['k', ['a', ['b', ['c']], ['a', ['x', ['c'], ['a', ['x', ['k']]], ['d', ['z']]]], ['d', ['m']]], ['d', ['e']]]]], ['d', ['e']]]];
2 changes: 1 addition & 1 deletion benchmark/index.js
Expand Up @@ -3,7 +3,7 @@
var Suite = require('benchmarked');
var suite = new Suite({
fixtures: 'fixtures/*.js',
add: 'code/*.js',
add: 'code/{lib-,arr-}*.js',
cwd: __dirname
});

Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "arr-flatten",
"version": "0.1.0",
"version": "0.2.1",
"main": [
"index.js"
]
Expand Down
8 changes: 4 additions & 4 deletions index.js
Expand Up @@ -7,19 +7,19 @@

'use strict';

module.exports = function (arr) {
return flatten(arr, []);
module.exports = function flatten(arr) {
return flat(arr, []);
};

function flatten(arr, res) {
function flat(arr, res) {
var len = arr.length;
var num = 0;

while (len--) {
var i = num++;

if (Array.isArray(arr[i])) {
flatten(arr[i], res);
flat(arr[i], res);
} else {
res.push(arr[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "arr-flatten",
"description": "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.",
"version": "0.2.0",
"version": "0.2.1",
"homepage": "https://github.com/jonschlinkert/arr-flatten",
"author": {
"name": "Jon Schlinkert",
Expand Down

0 comments on commit 8adf6d2

Please sign in to comment.