This commit is contained in:
Stephen Franceschelli 2019-07-30 13:41:05 -04:00
parent 596a6da241
commit c1a589c5b6
7078 changed files with 1882834 additions and 319 deletions

22
node_modules/p-reduce/index.js generated vendored Normal file
View file

@ -0,0 +1,22 @@
'use strict';
module.exports = (iterable, reducer, initVal) => new Promise((resolve, reject) => {
const iterator = iterable[Symbol.iterator]();
let i = 0;
const next = total => {
const el = iterator.next();
if (el.done) {
resolve(total);
return;
}
Promise.all([total, el.value])
.then(value => {
next(reducer(value[0], value[1], i++));
})
.catch(reject);
};
next(initVal);
});

21
node_modules/p-reduce/license generated vendored Normal file
View file

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

73
node_modules/p-reduce/package.json generated vendored Normal file
View file

@ -0,0 +1,73 @@
{
"_from": "p-reduce@^1.0.0",
"_id": "p-reduce@1.0.0",
"_inBundle": false,
"_integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=",
"_location": "/p-reduce",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "p-reduce@^1.0.0",
"name": "p-reduce",
"escapedName": "p-reduce",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/p-each-series"
],
"_resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
"_shasum": "18c2b0dd936a4690a529f8231f58a0fdb6a47dfa",
"_spec": "p-reduce@^1.0.0",
"_where": "E:\\github\\setup-java\\node_modules\\p-each-series",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/p-reduce/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Reduce a list of values using promises into a promise for a value",
"devDependencies": {
"ava": "*",
"delay": "^1.3.1",
"xo": "*"
},
"engines": {
"node": ">=4"
},
"files": [
"index.js"
],
"homepage": "https://github.com/sindresorhus/p-reduce#readme",
"keywords": [
"promise",
"reduce",
"collection",
"iterable",
"iterator",
"async",
"await",
"promises",
"accumulate",
"bluebird"
],
"license": "MIT",
"name": "p-reduce",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/p-reduce.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "1.0.0",
"xo": {
"esnext": true
}
}

72
node_modules/p-reduce/readme.md generated vendored Normal file
View file

@ -0,0 +1,72 @@
# p-reduce [![Build Status](https://travis-ci.org/sindresorhus/p-reduce.svg?branch=master)](https://travis-ci.org/sindresorhus/p-reduce)
> Reduce a list of values using promises into a promise for a value
Useful when you need to calculate some accumulated value based on async resources.
## Install
```
$ npm install --save p-reduce
```
## Usage
```js
const pReduce = require('p-reduce');
const humanInfo = require('human-info'); // not a real module
const names = [
getUser('sindresorhus').then(info => info.name),
'Addy Osmani',
'Pascal Hartig',
'Stephen Sawchuk'
];
pReduce(names, (total, name) => {
return humanInfo(name).then(info => total + info.age);
}, 0).then(totalAge => {
console.log(totalAge);
//=> 125
});
```
## API
### pReduce(input, reducer, [initialValue])
Returns a `Promise` that is fulfilled when all promises in `input` and ones returned from `reducer` are fulfilled, or rejects if any of the promises reject. The fulfilled value is the result of the reduction.
#### input
Type: `Iterable<Promise|any>`
Iterated over serially in the `reducer` function.
#### reducer(previousValue, currentValue, index)
Type: `Function`
Expected to return a value. If a `Promise` is returned, it's awaited before continuing with the next iteration.
#### initialValue
Type: `any`
Value to use as `previousValue` in the first `reducer` invocation.
## Related
- [p-each-series](https://github.com/sindresorhus/p-each-series) - Iterate over promises serially
- [p-map-series](https://github.com/sindresorhus/p-map-series) - Map over promises serially
- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently
- [More…](https://github.com/sindresorhus/promise-fun)
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)