ubdate
This commit is contained in:
12
node_modules/p-map-series/index.js
generated
vendored
Normal file
12
node_modules/p-map-series/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
const pReduce = require('p-reduce');
|
||||
|
||||
module.exports = (iterable, iterator) => {
|
||||
const ret = [];
|
||||
|
||||
return pReduce(iterable, (a, b, i) => {
|
||||
return Promise.resolve(iterator(b, i)).then(val => {
|
||||
ret.push(val);
|
||||
});
|
||||
}).then(() => ret);
|
||||
};
|
||||
21
node_modules/p-map-series/license
generated
vendored
Normal file
21
node_modules/p-map-series/license
generated
vendored
Normal 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.
|
||||
79
node_modules/p-map-series/package.json
generated
vendored
Normal file
79
node_modules/p-map-series/package.json
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
{
|
||||
"_from": "p-map-series@^1.0.0",
|
||||
"_id": "p-map-series@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-v5j+V1cFZYqeE1G++4WuTB8Hvco=",
|
||||
"_location": "/p-map-series",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "p-map-series@^1.0.0",
|
||||
"name": "p-map-series",
|
||||
"escapedName": "p-map-series",
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bin-build"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/p-map-series/-/p-map-series-1.0.0.tgz",
|
||||
"_shasum": "bf98fe575705658a9e1351befb85ae4c1f07bdca",
|
||||
"_spec": "p-map-series@^1.0.0",
|
||||
"_where": "/var/www/html/jason/WeihnachtenMelly/node_modules/bin-build",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/p-map-series/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"p-reduce": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Map over promises serially",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"delay": "^1.3.1",
|
||||
"time-span": "^1.0.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/p-map-series#readme",
|
||||
"keywords": [
|
||||
"promise",
|
||||
"map",
|
||||
"collection",
|
||||
"iterable",
|
||||
"iterator",
|
||||
"fulfilled",
|
||||
"serial",
|
||||
"serially",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"bluebird"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "p-map-series",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/p-map-series.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.0.0",
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
80
node_modules/p-map-series/readme.md
generated
vendored
Normal file
80
node_modules/p-map-series/readme.md
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
# p-map-series [](https://travis-ci.org/sindresorhus/p-map-series)
|
||||
|
||||
> Map over promises serially
|
||||
|
||||
Useful as a side-effect mapper. Use [`p-map`](https://github.com/sindresorhus/p-map) if you don't need side-effects, as it's concurrent.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save p-map-series
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pMapSeries = require('p-map-series');
|
||||
|
||||
const keywords = [
|
||||
getTopKeyword() //=> Promise
|
||||
'rainbow',
|
||||
'pony'
|
||||
];
|
||||
|
||||
let scores = [];
|
||||
|
||||
const mapper = keyword => fetchScore(keyword).then(score => {
|
||||
scores.push(score);
|
||||
return {keyword, score};
|
||||
});
|
||||
|
||||
pMapSeries(keywords, mapper).then(result => {
|
||||
console.log(result);
|
||||
/*
|
||||
[{
|
||||
keyword: 'unicorn',
|
||||
score: 99
|
||||
}, {
|
||||
keyword: 'rainbow',
|
||||
score: 70
|
||||
}, {
|
||||
keyword: 'pony',
|
||||
score: 79}
|
||||
]
|
||||
*/
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pMapSeries(input, mapper)
|
||||
|
||||
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 `mapper` created promises fulfillment values.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<Promise|any>`
|
||||
|
||||
Mapped over serially in the `mapper` function.
|
||||
|
||||
#### mapper(element, index)
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Expected to return a value. If it's a `Promise`, it's awaited before continuing with the next iteration.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [p-each-series](https://github.com/sindresorhus/p-each-series) - Iterate over promises serially
|
||||
- [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)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user