Add node modules and compiled JavaScript from main
This commit is contained in:
parent
8bccaeaf7c
commit
4181bfdf50
7465 changed files with 1775003 additions and 2 deletions
64
node_modules/p-each-series/index.d.ts
generated
vendored
Normal file
64
node_modules/p-each-series/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
declare const stop: unique symbol;
|
||||
|
||||
declare namespace pEachSeries {
|
||||
type StopSymbol = typeof stop;
|
||||
}
|
||||
|
||||
declare const pEachSeries: {
|
||||
/**
|
||||
Iterate over promises serially.
|
||||
|
||||
@param input - Iterated over serially in the `iterator` function.
|
||||
@param iterator - Return value is ignored unless it's `Promise`, then it's awaited before continuing with the next iteration.
|
||||
@returns A `Promise` that fulfills when all promises in `input` and ones returned from `iterator` are fulfilled, or rejects if any of the promises reject. The fulfillment value is the original `input`.
|
||||
|
||||
@example
|
||||
```
|
||||
import pEachSeries = require('p-each-series');
|
||||
|
||||
const keywords = [
|
||||
getTopKeyword(), //=> Promise
|
||||
'rainbow',
|
||||
'pony'
|
||||
];
|
||||
|
||||
const iterator = async element => saveToDiskPromise(element);
|
||||
|
||||
(async () => {
|
||||
console.log(await pEachSeries(keywords, iterator));
|
||||
//=> ['unicorn', 'rainbow', 'pony']
|
||||
})();
|
||||
```
|
||||
*/
|
||||
<ValueType>(
|
||||
input: Iterable<PromiseLike<ValueType> | ValueType>,
|
||||
iterator: (element: ValueType, index: number) => pEachSeries.StopSymbol | unknown
|
||||
): Promise<ValueType[]>;
|
||||
|
||||
/**
|
||||
Stop iterating through items by returning `pEachSeries.stop` from the iterator function.
|
||||
|
||||
@example
|
||||
```
|
||||
const pEachSeries = require('p-each-series');
|
||||
|
||||
// Logs `a` and `b`.
|
||||
const result = await pEachSeries(['a', 'b', 'c'], value => {
|
||||
console.log(value);
|
||||
|
||||
if (value === 'b') {
|
||||
return pEachSeries.stop;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(result);
|
||||
//=> ['a', 'b', 'c']
|
||||
```
|
||||
*/
|
||||
readonly stop: pEachSeries.StopSymbol;
|
||||
|
||||
// TODO: Remove this for the next major release
|
||||
default: typeof pEachSeries;
|
||||
};
|
||||
|
||||
export = pEachSeries;
|
22
node_modules/p-each-series/index.js
generated
vendored
Normal file
22
node_modules/p-each-series/index.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
const pEachSeries = async (iterable, iterator) => {
|
||||
let index = 0;
|
||||
|
||||
for (const value of iterable) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const returnValue = await iterator(await value, index++);
|
||||
|
||||
if (returnValue === pEachSeries.stop) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return iterable;
|
||||
};
|
||||
|
||||
pEachSeries.stop = Symbol('pEachSeries.stop');
|
||||
|
||||
module.exports = pEachSeries;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = pEachSeries;
|
9
node_modules/p-each-series/license
generated
vendored
Normal file
9
node_modules/p-each-series/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
48
node_modules/p-each-series/package.json
generated
vendored
Normal file
48
node_modules/p-each-series/package.json
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"name": "p-each-series",
|
||||
"version": "2.2.0",
|
||||
"description": "Iterate over promises serially",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-each-series",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"foreach",
|
||||
"for-each",
|
||||
"for",
|
||||
"each",
|
||||
"collection",
|
||||
"iterable",
|
||||
"iterator",
|
||||
"fulfilled",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"serial",
|
||||
"serially",
|
||||
"series",
|
||||
"bluebird"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"delay": "^4.1.0",
|
||||
"time-span": "^3.0.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
}
|
||||
}
|
78
node_modules/p-each-series/readme.md
generated
vendored
Normal file
78
node_modules/p-each-series/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
# p-each-series [](https://travis-ci.com/github/sindresorhus/p-each-series)
|
||||
|
||||
> Iterate over promises serially
|
||||
|
||||
Useful as a side-effect iterator. Prefer [`p-map`](https://github.com/sindresorhus/p-map) if you don't need side-effects, as it's concurrent.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install p-each-series
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pEachSeries = require('p-each-series');
|
||||
|
||||
const keywords = [
|
||||
getTopKeyword(), //=> Promise
|
||||
'rainbow',
|
||||
'pony'
|
||||
];
|
||||
|
||||
const iterator = async element => saveToDiskPromise(element);
|
||||
|
||||
(async () => {
|
||||
console.log(await pEachSeries(keywords, iterator));
|
||||
//=> ['unicorn', 'rainbow', 'pony']
|
||||
})();
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### pEachSeries(input, iterator)
|
||||
|
||||
Returns a `Promise` that is fulfilled when all promises in `input` and ones returned from `iterator` are fulfilled, or rejects if any of the promises reject. The fulfillment value is the original `input`.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<Promise | unknown>`
|
||||
|
||||
Iterated over serially in the `iterator` function.
|
||||
|
||||
#### iterator(element, index)
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Return value is ignored unless it's `Promise`, then it's awaited before continuing with the next iteration.
|
||||
|
||||
### pEachSeries.stop
|
||||
|
||||
Stop iterating through items by returning `pEachSeries.stop` from the iterator function.
|
||||
|
||||
```js
|
||||
const pEachSeries = require('p-each-series');
|
||||
|
||||
// Logs `a` and `b`.
|
||||
const result = await pEachSeries(['a', 'b', 'c'], value => {
|
||||
console.log(value);
|
||||
|
||||
if (value === 'b') {
|
||||
return pEachSeries.stop;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(result);
|
||||
//=> ['a', 'b', 'c']
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [p-map-series](https://github.com/sindresorhus/p-map-series) - Map over promises serially
|
||||
- [p-series](https://github.com/sindresorhus/p-series) - Run promise-returning & async functions in series
|
||||
- [p-pipe](https://github.com/sindresorhus/p-pipe) - Compose promise-returning & async functions into a reusable pipeline
|
||||
- [p-waterfall](https://github.com/sindresorhus/p-waterfall) - Run promise-returning & async functions in series, each passing its result to the next
|
||||
- [p-reduce](https://github.com/sindresorhus/p-reduce) - Reduce a list of values using promises into a promise for a value
|
||||
- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
Loading…
Add table
Add a link
Reference in a new issue