clean old files

This commit is contained in:
Daniel Rodriguez 2021-04-25 19:48:07 +02:00
parent 2d7b1e34d0
commit cc79cf906f
203 changed files with 12300 additions and 13288 deletions

13
node_modules/array-flatten/README.md generated vendored
View file

@ -5,7 +5,7 @@
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
> Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
> Flatten nested arrays.
## Installation
@ -21,14 +21,21 @@ var flatten = require('array-flatten')
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
flatten.depth([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
(function () {
flatten(arguments) //=> [1, 2, 3]
flatten.from(arguments) //=> [1, 2, 3]
})(1, [2, 3])
```
### Methods
* **flatten(array)** Flatten a nested array structure
* **flatten.from(arrayish)** Flatten an array-like structure (E.g. arguments)
* **flatten.depth(array, depth)** Flatten a nested array structure with a specific depth
* **flatten.fromDepth(arrayish, depth)** Flatten an array-like structure with a specific depth
## License
MIT

View file

@ -3,43 +3,78 @@
/**
* Expose `arrayFlatten`.
*/
module.exports = arrayFlatten
module.exports = flatten
module.exports.from = flattenFrom
module.exports.depth = flattenDepth
module.exports.fromDepth = flattenFromDepth
/**
* Recursive flatten function with depth.
* Flatten an array.
*
* @param {Array} array
* @param {Array} result
* @param {Number} depth
* @param {Array} array
* @return {Array}
*/
function flattenWithDepth (array, result, depth) {
for (var i = 0; i < array.length; i++) {
var value = array[i]
if (depth > 0 && Array.isArray(value)) {
flattenWithDepth(value, result, depth - 1)
} else {
result.push(value)
}
function flatten (array) {
if (!Array.isArray(array)) {
throw new TypeError('Expected value to be an array')
}
return result
return flattenFrom(array)
}
/**
* Recursive flatten function. Omitting depth is slightly faster.
* Flatten an array-like structure.
*
* @param {Array} array
* @return {Array}
*/
function flattenFrom (array) {
return flattenDown(array, [])
}
/**
* Flatten an array-like structure with depth.
*
* @param {Array} array
* @param {number} depth
* @return {Array}
*/
function flattenDepth (array, depth) {
if (!Array.isArray(array)) {
throw new TypeError('Expected value to be an array')
}
return flattenFromDepth(array, depth)
}
/**
* Flatten an array-like structure with depth.
*
* @param {Array} array
* @param {number} depth
* @return {Array}
*/
function flattenFromDepth (array, depth) {
if (typeof depth !== 'number') {
throw new TypeError('Expected the depth to be a number')
}
return flattenDownDepth(array, [], depth)
}
/**
* Flatten an array indefinitely.
*
* @param {Array} array
* @param {Array} result
* @return {Array}
*/
function flattenForever (array, result) {
function flattenDown (array, result) {
for (var i = 0; i < array.length; i++) {
var value = array[i]
if (Array.isArray(value)) {
flattenForever(value, result)
flattenDown(value, result)
} else {
result.push(value)
}
@ -49,16 +84,25 @@ function flattenForever (array, result) {
}
/**
* Flatten an array, with the ability to define a depth.
* Flatten an array with depth.
*
* @param {Array} array
* @param {Number} depth
* @param {Array} result
* @param {number} depth
* @return {Array}
*/
function arrayFlatten (array, depth) {
if (depth == null) {
return flattenForever(array, [])
function flattenDownDepth (array, result, depth) {
depth--
for (var i = 0; i < array.length; i++) {
var value = array[i]
if (depth > -1 && Array.isArray(value)) {
flattenDownDepth(value, result, depth)
} else {
result.push(value)
}
}
return flattenWithDepth(array, [], depth)
return result
}

View file

@ -1,27 +1,27 @@
{
"_from": "array-flatten@1.1.1",
"_id": "array-flatten@1.1.1",
"_from": "array-flatten@^2.1.0",
"_id": "array-flatten@2.1.2",
"_inBundle": false,
"_integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
"_integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==",
"_location": "/array-flatten",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "array-flatten@1.1.1",
"raw": "array-flatten@^2.1.0",
"name": "array-flatten",
"escapedName": "array-flatten",
"rawSpec": "1.1.1",
"rawSpec": "^2.1.0",
"saveSpec": null,
"fetchSpec": "1.1.1"
"fetchSpec": "^2.1.0"
},
"_requiredBy": [
"/express"
"/bonjour"
],
"_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"_shasum": "9a5f699051b1e7073328f2a008968b64ea2955d2",
"_spec": "array-flatten@1.1.1",
"_where": "D:\\tftapp\\node_modules\\express",
"_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz",
"_shasum": "24ef80a28c1a893617e2149b0c6d0d788293b099",
"_spec": "array-flatten@^2.1.0",
"_where": "D:\\TFTPaths\\node_modules\\bonjour",
"author": {
"name": "Blake Embrey",
"email": "hello@blakeembrey.com",
@ -32,15 +32,16 @@
},
"bundleDependencies": false,
"deprecated": false,
"description": "Flatten an array of nested arrays into a single flat array",
"description": "Flatten nested arrays",
"devDependencies": {
"istanbul": "^0.3.13",
"mocha": "^2.2.4",
"pre-commit": "^1.0.7",
"standard": "^3.7.3"
"benchmarked": "^2.0.0",
"istanbul": "^0.4.0",
"mocha": "^3.1.2",
"standard": "^10.0.0"
},
"files": [
"array-flatten.js",
"array-flatten.d.ts",
"LICENSE"
],
"homepage": "https://github.com/blakeembrey/array-flatten",
@ -48,7 +49,9 @@
"array",
"flatten",
"arguments",
"depth"
"depth",
"fast",
"for"
],
"license": "MIT",
"main": "array-flatten.js",
@ -58,7 +61,12 @@
"url": "git://github.com/blakeembrey/array-flatten.git"
},
"scripts": {
"test": "istanbul cover _mocha -- -R spec"
"benchmark": "node benchmark",
"lint": "standard",
"test": "npm run lint && npm run test-cov",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec --bail",
"test-spec": "mocha -R spec --bail"
},
"version": "1.1.1"
"typings": "array-flatten.d.ts",
"version": "2.1.2"
}