Last commit july 5th

This commit is contained in:
2024-07-05 13:46:23 +02:00
parent dad0d86e8c
commit b0e4dfbb76
24982 changed files with 2621219 additions and 413 deletions

71
spa/node_modules/p-map/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,71 @@
declare namespace pMap {
interface Options {
/**
Number of concurrently pending promises returned by `mapper`.
@default Infinity
*/
concurrency?: number;
}
/**
Function which is called for every item in `input`. Expected to return a `Promise` or value.
@param input - Iterated element.
@param index - Index of the element in the source array.
*/
type Mapper<Element = any, NewElement = any> = (
input: Element,
index: number
) => NewElement | Promise<NewElement>;
}
declare const pMap: {
/**
Returns a `Promise` that is fulfilled when all promises in `input` and ones returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `mapper` in `input` order.
@param input - Iterated over concurrently in the `mapper` function.
@param mapper - Function which is called for every item in `input`. Expected to return a `Promise` or value.
@example
```
import pMap = require('p-map');
import got = require('got');
const sites = [
getWebsiteFromUsername('sindresorhus'), //=> Promise
'ava.li',
'todomvc.com',
'github.com'
];
(async () => {
const mapper = async site => {
const {requestUrl} = await got.head(site);
return requestUrl;
};
const result = await pMap(sites, mapper, {concurrency: 2});
console.log(result);
//=> ['http://sindresorhus.com/', 'http://ava.li/', 'http://todomvc.com/', 'http://github.com/']
})();
```
*/
<Element, NewElement>(
input: Iterable<Element>,
mapper: pMap.Mapper<Element, NewElement>,
options?: pMap.Options
): Promise<NewElement[]>;
// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function pMap<Element, NewElement>(
// input: Iterable<Element>,
// mapper: pMap.Mapper<Element, NewElement>,
// options?: pMap.Options
// ): Promise<NewElement[]>;
// export = pMap;
default: typeof pMap;
};
export = pMap;

72
spa/node_modules/p-map/index.js generated vendored Normal file
View File

@@ -0,0 +1,72 @@
'use strict';
const pMap = (iterable, mapper, options) => new Promise((resolve, reject) => {
options = Object.assign({
concurrency: Infinity
}, options);
if (typeof mapper !== 'function') {
throw new TypeError('Mapper function is required');
}
const {concurrency} = options;
if (!(typeof concurrency === 'number' && concurrency >= 1)) {
throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${concurrency}\` (${typeof concurrency})`);
}
const ret = [];
const iterator = iterable[Symbol.iterator]();
let isRejected = false;
let isIterableDone = false;
let resolvingCount = 0;
let currentIndex = 0;
const next = () => {
if (isRejected) {
return;
}
const nextItem = iterator.next();
const i = currentIndex;
currentIndex++;
if (nextItem.done) {
isIterableDone = true;
if (resolvingCount === 0) {
resolve(ret);
}
return;
}
resolvingCount++;
Promise.resolve(nextItem.value)
.then(element => mapper(element, i))
.then(
value => {
ret[i] = value;
resolvingCount--;
next();
},
error => {
isRejected = true;
reject(error);
}
);
};
for (let i = 0; i < concurrency; i++) {
next();
if (isIterableDone) {
break;
}
}
});
module.exports = pMap;
// TODO: Remove this for the next major release
module.exports.default = pMap;

9
spa/node_modules/p-map/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
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.

49
spa/node_modules/p-map/package.json generated vendored Normal file
View File

@@ -0,0 +1,49 @@
{
"name": "p-map",
"version": "2.1.0",
"description": "Map over promises concurrently",
"license": "MIT",
"repository": "sindresorhus/p-map",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"promise",
"map",
"resolved",
"wait",
"collection",
"iterable",
"iterator",
"race",
"fulfilled",
"async",
"await",
"promises",
"concurrently",
"concurrency",
"parallel",
"bluebird"
],
"devDependencies": {
"ava": "^1.4.1",
"delay": "^4.1.0",
"in-range": "^1.0.0",
"random-int": "^1.0.0",
"time-span": "^3.1.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

85
spa/node_modules/p-map/readme.md generated vendored Normal file
View File

@@ -0,0 +1,85 @@
# p-map [![Build Status](https://travis-ci.org/sindresorhus/p-map.svg?branch=master)](https://travis-ci.org/sindresorhus/p-map)
> Map over promises concurrently
Useful when you need to run promise-returning & async functions multiple times with different inputs concurrently.
## Install
```
$ npm install p-map
```
## Usage
```js
const pMap = require('p-map');
const got = require('got');
const sites = [
getWebsiteFromUsername('sindresorhus'), //=> Promise
'ava.li',
'todomvc.com',
'github.com'
];
(async () => {
const mapper = async site => {
const {requestUrl} = await got.head(site);
return requestUrl;
};
const result = await pMap(sites, mapper, {concurrency: 2});
console.log(result);
//=> ['http://sindresorhus.com/', 'http://ava.li/', 'http://todomvc.com/', 'http://github.com/']
})();
```
## API
### pMap(input, mapper, [options])
Returns a `Promise` that is fulfilled when all promises in `input` and ones returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `mapper` in `input` order.
#### input
Type: `Iterable<Promise|any>`
Iterated over concurrently in the `mapper` function.
#### mapper(element, index)
Type: `Function`
Expected to return a `Promise` or value.
#### options
Type: `Object`
##### concurrency
Type: `number`<br>
Default: `Infinity`<br>
Minimum: `1`
Number of concurrently pending promises returned by `mapper`.
## Related
- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency
- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently
- [p-times](https://github.com/sindresorhus/p-times) - Run promise-returning & async functions a specific number of times concurrently
- [p-props](https://github.com/sindresorhus/p-props) - Like `Promise.all()` but for `Map` and `Object`
- [p-map-series](https://github.com/sindresorhus/p-map-series) - Map over promises serially
- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control
- [More…](https://github.com/sindresorhus/promise-fun)
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)