[Pkg-javascript-commits] [node-arr-flatten] 01/07: Import Upstream version 1.0.1

Sruthi Chandran srud-guest at moszumanska.debian.org
Tue Oct 25 11:13:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

srud-guest pushed a commit to branch master
in repository node-arr-flatten.

commit 2fc2910294e98b1d59f5c252a9d0c29920e49177
Author: Sruthi <srud at disroot.org>
Date:   Tue Oct 25 12:43:37 2016 +0530

    Import Upstream version 1.0.1
---
 .editorconfig                           | 27 ++++++++++++
 .gitattributes                          | 10 +++++
 .gitignore                              | 53 ++++++++++++++++++++++++
 .jshintrc                               | 18 ++++++++
 .travis.yml                             |  8 ++++
 .verb.md                                | 61 +++++++++++++++++++++++++++
 LICENSE                                 | 21 ++++++++++
 README.md                               | 73 +++++++++++++++++++++++++++++++++
 benchmark/check.js                      | 28 +++++++++++++
 benchmark/code/arr-flatten-2.js         | 25 +++++++++++
 benchmark/code/arr-flatten-3.js         | 25 +++++++++++
 benchmark/code/arr-flatten.js           | 25 +++++++++++
 benchmark/code/current.js               |  1 +
 benchmark/code/do-while-slice.js        | 13 ++++++
 benchmark/code/do-while.js              | 15 +++++++
 benchmark/code/lib-array-flatten.js     |  3 ++
 benchmark/code/while-args.js            | 24 +++++++++++
 benchmark/code/while-depth.js           | 26 ++++++++++++
 benchmark/code/while-no-depth-check.js  | 25 +++++++++++
 benchmark/code/while-no-depth-typeof.js | 24 +++++++++++
 benchmark/fixtures/large.js             |  1 +
 benchmark/fixtures/medium.js            |  1 +
 benchmark/fixtures/small.js             |  1 +
 benchmark/index.js                      | 11 +++++
 bower.json                              |  7 ++++
 index.js                                | 27 ++++++++++++
 package.json                            | 51 +++++++++++++++++++++++
 test.js                                 | 25 +++++++++++
 28 files changed, 629 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..32dd133
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,27 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = space
+end_of_line = lf
+charset = utf-8
+indent_size = 2
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.json]
+indent_style = space
+indent_size = 2
+
+[*.yml]
+indent_style = space
+indent_size = 2
+
+[*.md]
+indent_style = space
+indent_size = 2
+trim_trailing_whitespace = false
+
+[test/fixtures/*]
+trim_trailing_whitespace = false
+insert_final_newline = false
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..4a3f1d3
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,10 @@
+# Enforce Unix newlines
+* text eol=lf
+
+# binaries
+*.ai binary
+*.psd binary
+*.jpg binary
+*.gif binary
+*.png binary
+*.jpeg binary
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..92139bd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,53 @@
+# Numerous always-ignore extensions
+*.DS_Store
+*.csv
+*.dat
+*.diff
+*.err
+*.gz
+*.log
+*.orig
+*.out
+*.pid
+*.rar
+*.rej
+*.seed
+*.swo
+*.swp
+*.vi
+*.yo-rc.json
+*.zip
+*~
+.ruby-version
+lib-cov
+npm-debug.log
+
+# Always-ignore dirs
+/bower_components/
+/node_modules/
+/temp/
+/tmp/
+/vendor/
+_gh_pages
+
+# OS or Editor folders
+*.esproj
+*.komodoproject
+.komodotools
+*.sublime-*
+._*
+.cache
+.DS_Store
+.idea
+.project
+.settings
+.tmproj
+nbproject
+Thumbs.db
+
+# grunt-html-validation
+validation-status.json
+validation-report.json
+
+# misc
+TODO.md
\ No newline at end of file
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..6e5a84a
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,18 @@
+{
+  "asi": false,
+  "boss": true,
+  "curly": true,
+  "eqeqeq": true,
+  "eqnull": true,
+  "esnext": true,
+  "immed": true,
+  "latedef": false,
+  "laxcomma": false,
+  "mocha": true,
+  "newcap": true,
+  "noarg": true,
+  "node": true,
+  "sub": true,
+  "undef": true,
+  "unused": true
+}
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..efe94c0
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,8 @@
+sudo: false
+language: node_js
+node_js:
+  - "0.10"
+  - "0.12"
+  - "iojs"
+git:
+  depth: 10
\ No newline at end of file
diff --git a/.verb.md b/.verb.md
new file mode 100644
index 0000000..e76b7da
--- /dev/null
+++ b/.verb.md
@@ -0,0 +1,61 @@
+# {%= name %} {%= badge("fury") %} {%= badge("travis") %}
+
+> {%= description %}
+
+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
+
+```bash
+npm run benchmarks
+```
+
+Benchmark results comparing this library to [array-flatten]:
+
+```bash
+#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:
+
+```bash
+npm i -d && npm test
+```
+
+{%= include("install-npm", {save: true}) %}
+{%= include("install-bower", {save: true}) %}
+
+
+## Usage
+
+```js
+var flatten = require('{%= name %}');
+
+flatten(['a', ['b', ['c']], 'd', ['e']]);
+//=> ['a', 'b', 'c', 'd', 'e']
+```
+
+## Author
+{%= include("author") %}
+
+## License
+{%= copyright({start: 2014}) %}
+{%= license() %}
+
+***
+
+{%= include("footer") %}
+
+[array-flatten]: https://github.com/blakeembrey/array-flatten
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..fa30c4c
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-2015, Jon Schlinkert.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..bd696e6
--- /dev/null
+++ b/README.md
@@ -0,0 +1,73 @@
+# arr-flatten [![NPM version](https://badge.fury.io/js/arr-flatten.svg)](http://badge.fury.io/js/arr-flatten)  [![Build Status](https://travis-ci.org/jonschlinkert/arr-flatten.svg)](https://travis-ci.org/jonschlinkert/arr-flatten) 
+
+> 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
+
+```bash
+npm run benchmarks
+```
+
+Benchmark results comparing this library to [array-flatten]:
+
+```bash
+#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:
+
+```bash
+npm i -d && npm test
+```
+
+## Install with [npm](npmjs.org)
+
+```bash
+npm i arr-flatten --save
+```
+### Install with [bower](https://github.com/bower/bower)
+
+```bash
+bower install arr-flatten --save
+```
+
+
+## Usage
+
+```js
+var flatten = require('arr-flatten');
+
+flatten(['a', ['b', ['c']], 'd', ['e']]);
+//=> ['a', 'b', 'c', 'd', 'e']
+```
+
+## Author
+
+**Jon Schlinkert**
+ 
++ [github/jonschlinkert](https://github.com/jonschlinkert)
++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) 
+
+## License
+Copyright (c) 2014-2015 Jon Schlinkert  
+Released under the MIT license
+
+***
+
+_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 11, 2015._
+
+[array-flatten]: https://github.com/blakeembrey/array-flatten
\ No newline at end of file
diff --git a/benchmark/check.js b/benchmark/check.js
new file mode 100644
index 0000000..e45b2e4
--- /dev/null
+++ b/benchmark/check.js
@@ -0,0 +1,28 @@
+'use strict';
+
+var path = require('path');
+var util = require('util');
+var glob = require('glob');
+var chalk = require('chalk');
+
+/**
+ * Sanity check
+ *
+ * Run to ensure that all fns return the same, correct result.
+ */
+
+var fixtures = glob.sync(__dirname + '/fixtures/l*.js');
+
+glob.sync(__dirname + '/code/*.js').forEach(function (fp) {
+  var fn = require(path.resolve(__dirname, 'code', fp));
+  var name = path.basename(fp, path.extname(fp));
+
+  fixtures.forEach(function (fixture) {
+    console.log(chalk.bold(name) + ':', inspect(fn(require(fixture))));
+  });
+});
+
+function inspect(o) {
+  var str = util.inspect(o, {depth: null});
+  return str.replace(/[\s\n]+/g, ' ');
+}
\ No newline at end of file
diff --git a/benchmark/code/arr-flatten-2.js b/benchmark/code/arr-flatten-2.js
new file mode 100644
index 0000000..90da257
--- /dev/null
+++ b/benchmark/code/arr-flatten-2.js
@@ -0,0 +1,25 @@
+'use strict';
+
+/**
+ * current implementation
+ */
+
+module.exports = function (arr) {
+  return flatten(arr, []);
+};
+
+function flatten(arr, res) {
+  var len = arr.length;
+  var num = 0;
+
+  while (len--) {
+    var i = num++;
+
+    if (Array.isArray(arr[i])) {
+      flatten(arr[i], res);
+    } else {
+      res.push(arr[i]);
+    }
+  }
+  return res;
+}
diff --git a/benchmark/code/arr-flatten-3.js b/benchmark/code/arr-flatten-3.js
new file mode 100644
index 0000000..85b0517
--- /dev/null
+++ b/benchmark/code/arr-flatten-3.js
@@ -0,0 +1,25 @@
+'use strict';
+
+/**
+ * current implementation
+ */
+
+module.exports = function (arr) {
+  return flatten(arr, []);
+};
+
+function flatten(arr, res) {
+  var len = arr.length;
+  var num = 0;
+
+  while (len--) {
+    var i = num++;
+
+    if (!Array.isArray(arr[i])) {
+      res.push(arr[i]);
+    } else {
+      flatten(arr[i], res);
+    }
+  }
+  return res;
+}
diff --git a/benchmark/code/arr-flatten.js b/benchmark/code/arr-flatten.js
new file mode 100644
index 0000000..90da257
--- /dev/null
+++ b/benchmark/code/arr-flatten.js
@@ -0,0 +1,25 @@
+'use strict';
+
+/**
+ * current implementation
+ */
+
+module.exports = function (arr) {
+  return flatten(arr, []);
+};
+
+function flatten(arr, res) {
+  var len = arr.length;
+  var num = 0;
+
+  while (len--) {
+    var i = num++;
+
+    if (Array.isArray(arr[i])) {
+      flatten(arr[i], res);
+    } else {
+      res.push(arr[i]);
+    }
+  }
+  return res;
+}
diff --git a/benchmark/code/current.js b/benchmark/code/current.js
new file mode 100644
index 0000000..24b4202
--- /dev/null
+++ b/benchmark/code/current.js
@@ -0,0 +1 @@
+module.exports = require('../..');
\ No newline at end of file
diff --git a/benchmark/code/do-while-slice.js b/benchmark/code/do-while-slice.js
new file mode 100644
index 0000000..285a190
--- /dev/null
+++ b/benchmark/code/do-while-slice.js
@@ -0,0 +1,13 @@
+'use strict';
+
+var slice = require('array-slice');
+
+module.exports = function () {
+  var args = slice(arguments);
+
+  do {
+    args = [].concat.apply([], args);
+  } while (args.some(Array.isArray));
+
+  return args;
+};
\ No newline at end of file
diff --git a/benchmark/code/do-while.js b/benchmark/code/do-while.js
new file mode 100644
index 0000000..56666af
--- /dev/null
+++ b/benchmark/code/do-while.js
@@ -0,0 +1,15 @@
+'use strict';
+
+/**
+ * this was used in v0.1.0
+ */
+
+module.exports = function () {
+  var args = [].slice.call(arguments);
+
+  do {
+    args = [].concat.apply([], args);
+  } while (args.some(Array.isArray));
+
+  return args;
+};
\ No newline at end of file
diff --git a/benchmark/code/lib-array-flatten.js b/benchmark/code/lib-array-flatten.js
new file mode 100644
index 0000000..7ff8825
--- /dev/null
+++ b/benchmark/code/lib-array-flatten.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = require('array-flatten');
\ No newline at end of file
diff --git a/benchmark/code/while-args.js b/benchmark/code/while-args.js
new file mode 100644
index 0000000..686882d
--- /dev/null
+++ b/benchmark/code/while-args.js
@@ -0,0 +1,24 @@
+'use strict';
+
+var slice = require('array-slice');
+
+module.exports = function () {
+  var arr = slice(arguments);
+  return flatten(arr, []);
+};
+
+function flatten(arr, res) {
+  var len = arr.length;
+  var num = 0;
+
+  while (len--) {
+    var i = num++;
+
+    if (Array.isArray(arr[i])) {
+      flatten(arr[i], res);
+    } else {
+      res.push(arr[i]);
+    }
+  }
+  return res;
+}
diff --git a/benchmark/code/while-depth.js b/benchmark/code/while-depth.js
new file mode 100644
index 0000000..55952f1
--- /dev/null
+++ b/benchmark/code/while-depth.js
@@ -0,0 +1,26 @@
+'use strict';
+
+module.exports = function (arr, depth) {
+  if (depth < 1) {
+    return arr;
+  }
+  return flatten(arr, [], depth || Infinity);
+};
+
+function flatten(arr, res, depth) {
+  depth--;
+
+  var len = arr.length;
+  var num = 0;
+
+  while (len--) {
+    var i = num++;
+
+    if (depth > -1 && Array.isArray(arr[i])) {
+      flatten(arr[i], res, depth);
+    } else {
+      res.push(arr[i]);
+    }
+  }
+  return res;
+}
diff --git a/benchmark/code/while-no-depth-check.js b/benchmark/code/while-no-depth-check.js
new file mode 100644
index 0000000..3df15de
--- /dev/null
+++ b/benchmark/code/while-no-depth-check.js
@@ -0,0 +1,25 @@
+'use strict';
+
+module.exports = function (arr) {
+  if (!arr.some(Array.isArray)) {
+    return arr;
+  }
+  return flatten(arr, []);
+};
+
+function flatten(arr, res) {
+  var len = arr.length;
+  var num = 0;
+
+  while (len--) {
+    var i = num++;
+
+    if (Array.isArray(arr[i])) {
+      flatten(arr[i], res);
+    } else {
+      res.push(arr[i]);
+    }
+  }
+
+  return res;
+}
diff --git a/benchmark/code/while-no-depth-typeof.js b/benchmark/code/while-no-depth-typeof.js
new file mode 100644
index 0000000..756e532
--- /dev/null
+++ b/benchmark/code/while-no-depth-typeof.js
@@ -0,0 +1,24 @@
+'use strict';
+
+var typeOf = require('kind-of');
+
+module.exports = function (arr) {
+  return flatten(arr, []);
+};
+
+function flatten(arr, res) {
+  var len = arr.length;
+  var num = 0;
+
+  while (len--) {
+    var i = num++;
+
+    if (typeOf(arr[i]) === 'array') {
+      flatten(arr[i], res);
+    } else {
+      res.push(arr[i]);
+    }
+  }
+
+  return res;
+}
diff --git a/benchmark/fixtures/large.js b/benchmark/fixtures/large.js
new file mode 100644
index 0000000..4c9c5b3
--- /dev/null
+++ b/benchmark/fixtures/large.js
@@ -0,0 +1 @@
+module.exports = [[['a', ['b', ['k', ['a', ['b', ['c'], [['a', [['a', ['b', ['k', ['a', ['b', ['c']], ['a', ['x', ['c'], ['a', ['x', ['k']]], ['d', ['z']]]], ['d', ['m']]], ['d', ['e']]]]], ['d', ['e']]], ['b', ['k', ['a', ['b', ['c']], ['a', ['x', ['c'], ['a', ['x', ['k']]], ['d', ['z']]]], ['d', ['m']]], ['d', ['e']]]]], ['d', ['e']]]], ['a', ['x', ['c'], ['a', ['x', ['k']], [['a', ['b', ['k', ['a', ['b', ['c']], ['a', ['x', ['c'], ['a', ['x', ['k']]], ['d', ['z']]]], ['d', ['m']]], [' [...]
\ No newline at end of file
diff --git a/benchmark/fixtures/medium.js b/benchmark/fixtures/medium.js
new file mode 100644
index 0000000..7e9dc7d
--- /dev/null
+++ b/benchmark/fixtures/medium.js
@@ -0,0 +1 @@
+module.exports = [[['a', ['b', ['k', ['a', ['b', ['c']], ['a', ['x', ['c'], ['a', ['x', ['k']]], ['d', ['z']]]], ['d', ['m']]], ['d', ['e']]]]], ['d', ['e']]]];
diff --git a/benchmark/fixtures/small.js b/benchmark/fixtures/small.js
new file mode 100644
index 0000000..80c0c79
--- /dev/null
+++ b/benchmark/fixtures/small.js
@@ -0,0 +1 @@
+module.exports = [[['a', ['b', ['c']]], ['d', ['e']]]];
diff --git a/benchmark/index.js b/benchmark/index.js
new file mode 100644
index 0000000..7cf8f46
--- /dev/null
+++ b/benchmark/index.js
@@ -0,0 +1,11 @@
+'use strict';
+
+var Suite = require('benchmarked');
+var suite = new Suite({
+  result: false,
+  fixtures: 'fixtures/*.js',
+  add: 'code/{lib*,current}.js',
+  cwd: __dirname
+});
+
+suite.run();
diff --git a/bower.json b/bower.json
new file mode 100644
index 0000000..af694aa
--- /dev/null
+++ b/bower.json
@@ -0,0 +1,7 @@
+{
+  "name": "arr-flatten",
+  "version": "0.2.1",
+  "main": [
+    "index.js"
+  ]
+}
\ No newline at end of file
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..f74e48c
--- /dev/null
+++ b/index.js
@@ -0,0 +1,27 @@
+/*!
+ * arr-flatten <https://github.com/jonschlinkert/arr-flatten>
+ *
+ * Copyright (c) 2014-2015, Jon Schlinkert.
+ * Licensed under the MIT License.
+ */
+
+'use strict';
+
+module.exports = function flatten(arr) {
+  return flat(arr, []);
+};
+
+function flat(arr, res) {
+  var len = arr.length;
+  var i = -1;
+
+  while (len--) {
+    var cur = arr[++i];
+    if (Array.isArray(cur)) {
+      flat(cur, res);
+    } else {
+      res.push(cur);
+    }
+  }
+  return res;
+}
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..8d0322d
--- /dev/null
+++ b/package.json
@@ -0,0 +1,51 @@
+{
+  "name": "arr-flatten",
+  "description": "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.",
+  "version": "1.0.1",
+  "homepage": "https://github.com/jonschlinkert/arr-flatten",
+  "author": {
+    "name": "Jon Schlinkert",
+    "url": "https://github.com/jonschlinkert"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/jonschlinkert/arr-flatten.git"
+  },
+  "bugs": {
+    "url": "https://github.com/jonschlinkert/arr-flatten/issues"
+  },
+  "license": {
+    "type": "MIT",
+    "url": "https://github.com/jonschlinkert/arr-flatten/blob/master/LICENSE"
+  },
+  "files": [
+    "index.js"
+  ],
+  "main": "index.js",
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "scripts": {
+    "test": "mocha",
+    "benchmarks": "node benchmark"
+  },
+  "devDependencies": {
+    "array-flatten": "^1.0.2",
+    "array-slice": "^0.2.2",
+    "benchmarked": "^0.1.3",
+    "chalk": "^0.5.1",
+    "glob": "^4.3.5",
+    "kind-of": "^1.0.0"
+  },
+  "keywords": [
+    "arr",
+    "array",
+    "elements",
+    "flat",
+    "flatten",
+    "nested",
+    "recurse",
+    "recursive",
+    "recursively"
+  ]
+}
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..9d5b9f0
--- /dev/null
+++ b/test.js
@@ -0,0 +1,25 @@
+/*!
+ * arr-flatten <https://github.com/jonschlinkert/arr-flatten>
+ *
+ * Copyright (c) 2014-2015, Jon Schlinkert.
+ * Licensed under the MIT License.
+ */
+
+'use strict';
+
+var assert = require('assert');
+var flatten = require('./');
+var arrFlatten = require('array-flatten');
+
+describe('flatten', function () {
+  it('should flatten nested arrays:', function () {
+    assert.deepEqual(flatten(['a', 'b', ['c'], 'd', ['e']]), ['a', 'b', 'c', 'd', 'e']);
+  });
+
+  it('should flatten deeply nested arrays:', function () {
+    assert.deepEqual(flatten(['a', [[[[[[[['b', [['c']]]]]], 'd', ['e']]]]]]), ['a', 'b', 'c', 'd', 'e']);
+    assert.deepEqual(flatten(['a', 'b', ['c'], 'd', ['e']]), ['a', 'b', 'c', 'd', 'e']);
+    assert.deepEqual(flatten([['a', ['b', ['k', ['a', ['b', ['c'], [['a', [['a', ['b', ['k', ['a', ['b', ['c']], ['a', ['x', ['c'], ['a', ['x', ['k']]], ['d', ['z']]]], ['d', ['m']]], ['d', ['e']]]]], ['d', ['e']]], ['b', ['k', ['a', ['b', ['c']], ['a', ['x', ['c'], ['a', ['x', ['k']]], ['d', ['z']]]], ['d', ['m']]], ['d', ['e']]]]], ['d', ['e']]]], ['a', ['x', ['c'], ['a', ['x', ['k']], [['a', ['b', ['k', ['a', ['b', ['c']], ['a', ['x', ['c'], ['a', ['x', ['k']]], ['d', ['z']]]], ['d',  [...]
+  });
+});
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-arr-flatten.git



More information about the Pkg-javascript-commits mailing list