diff options
Diffstat (limited to 'node_modules/flatten')
| -rw-r--r-- | node_modules/flatten/LICENSE | 21 | ||||
| -rw-r--r-- | node_modules/flatten/README.md | 34 | ||||
| -rw-r--r-- | node_modules/flatten/index.js | 23 | ||||
| -rw-r--r-- | node_modules/flatten/package.json | 35 | ||||
| -rw-r--r-- | node_modules/flatten/test.js | 25 |
5 files changed, 0 insertions, 138 deletions
diff --git a/node_modules/flatten/LICENSE b/node_modules/flatten/LICENSE deleted file mode 100644 index 54a689b8..00000000 --- a/node_modules/flatten/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Joshua Holbrook - -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/node_modules/flatten/README.md b/node_modules/flatten/README.md deleted file mode 100644 index 7b0a3b69..00000000 --- a/node_modules/flatten/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# flatten - -A tiny utility to flatten arrays of arrays (of arrays, etc., recursively, infinitely or to an optional depth) into a single array of non-arrays. - -## example: - -```js -> var flatten = require('flatten'); -undefined -> flatten([1, [2, 3], [4, 5, 6], [7, [8, 9]], 10]) -[ 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10 ] -> flatten([1, [2, [3, [4, [5]]]]], 2) -[ 1, - 2, - 3, - [ 4, [ 5 ] ] ] -``` - -## install: - - npm install flatten - -## license: - -MIT/X11. diff --git a/node_modules/flatten/index.js b/node_modules/flatten/index.js deleted file mode 100644 index a9bd9b8c..00000000 --- a/node_modules/flatten/index.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = function flatten(list, depth) { - depth = (typeof depth == 'number') ? depth : Infinity; - - if (!depth) { - if (Array.isArray(list)) { - return list.map(function(i) { return i; }); - } - return list; - } - - return _flatten(list, 1); - - function _flatten(list, d) { - return list.reduce(function (acc, item) { - if (Array.isArray(item) && d < depth) { - return acc.concat(_flatten(item, d + 1)); - } - else { - return acc.concat(item); - } - }, []); - } -}; diff --git a/node_modules/flatten/package.json b/node_modules/flatten/package.json deleted file mode 100644 index b5903d91..00000000 --- a/node_modules/flatten/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ "name": "flatten", - "version": "1.0.3", - "description": "Flatten arbitrarily nested arrays into a non-nested list of non-array items. Maintained for legacy compatibility.", - "keywords": [ - "array", - "flatten" - ], - - "author": "Joshua Holbrook <josh.holbrook@gmail.com> (http://jesusabdullah.net)", - "homepage": "https://github.com/mk-pmb/flatten-js/#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/mk-pmb/flatten-js.git" - }, - "bugs": { - "url": "https://github.com/mk-pmb/flatten-js/issues" - }, - "contributors": [ - "M.K. (https://github.com/mk-pmb)" - ], - - "private": false, "license": "MIT", - - "scripts": { - "test": "node ./test.js" - }, - "directories": { "test": "test" }, - - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - - - "npm vs. BOM = Unexpected token": "-*- coding: UTF-8 -*-" -} diff --git a/node_modules/flatten/test.js b/node_modules/flatten/test.js deleted file mode 100644 index 385c27fa..00000000 --- a/node_modules/flatten/test.js +++ /dev/null @@ -1,25 +0,0 @@ -var flatten = require('./index'), - util = require('util'), - assert = require('assert'); - -[ - [ [1, [ 2, 3]], [1, [2, 3]], 0], - [ [1, 2, 3 ], [1, 2, 3] ], - [ ['a', ['b', ['c']]], ['a', 'b', 'c'] ], - [ [2, [4, 6], 8, [[10]]], [2, 4, 6, 8, 10] ], - [ [1, [2, [3, [4, [5]]]]], [1, 2, 3, [4, [5]]], 2 ] // depth of 2 -].forEach(function (t) { - assert.deepEqual(flatten(t[0], t[2]), t[1], - util.format('☠☠☠☠☠☠☠☠☠ %s ☠☠☠☠☠☠☠☠☠', formatCall(t)) - ); - console.log('✓ %s', formatCall(t)); -}); - -function formatCall(t) { - if (typeof t[2] === 'undefined') { - return util.format('`flatten(%j) == %j`', t[0], t[1]); - } - else { - return util.format('`flatten(%j, %j) == %j`', t[0], t[2], t[1]); - } -} |
