p-each-series
Advanced tools
Comparing version 2.2.0 to 3.0.0
declare const stop: unique symbol; | ||
declare namespace pEachSeries { | ||
type StopSymbol = typeof stop; | ||
} | ||
export type StopSymbol = typeof stop; | ||
declare const pEachSeries: { | ||
/** | ||
Stop iterating through items by returning `pEachSeries.stop` from the iterator function. | ||
@example | ||
``` | ||
import pEachSeries from '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: StopSymbol; | ||
/** | ||
Iterate over promises serially. | ||
@@ -17,3 +37,3 @@ | ||
``` | ||
import pEachSeries = require('p-each-series'); | ||
import pEachSeries from 'p-each-series'; | ||
@@ -28,6 +48,4 @@ const keywords = [ | ||
(async () => { | ||
console.log(await pEachSeries(keywords, iterator)); | ||
//=> ['unicorn', 'rainbow', 'pony'] | ||
})(); | ||
console.log(await pEachSeries(keywords, iterator)); | ||
//=> ['unicorn', 'rainbow', 'pony'] | ||
``` | ||
@@ -37,31 +55,6 @@ */ | ||
input: Iterable<PromiseLike<ValueType> | ValueType>, | ||
iterator: (element: ValueType, index: number) => pEachSeries.StopSymbol | unknown | ||
iterator: (element: ValueType, index: number) => 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; | ||
export default pEachSeries; |
@@ -1,3 +0,1 @@ | ||
'use strict'; | ||
const pEachSeries = async (iterable, iterator) => { | ||
@@ -20,4 +18,2 @@ let index = 0; | ||
module.exports = pEachSeries; | ||
// TODO: Remove this for the next major release | ||
module.exports.default = pEachSeries; | ||
export default pEachSeries; |
{ | ||
"name": "p-each-series", | ||
"version": "2.2.0", | ||
"version": "3.0.0", | ||
"description": "Iterate over promises serially", | ||
@@ -13,4 +13,6 @@ "license": "MIT", | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=12" | ||
}, | ||
@@ -43,8 +45,8 @@ "scripts": { | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"delay": "^4.1.0", | ||
"time-span": "^3.0.0", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
"ava": "^3.15.0", | ||
"delay": "^5.0.0", | ||
"time-span": "^4.0.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.38.2" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# p-each-series [![Build Status](https://travis-ci.com/sindresorhus/p-each-series.svg?branch=master)](https://travis-ci.com/github/sindresorhus/p-each-series) | ||
# p-each-series | ||
@@ -16,3 +16,3 @@ > Iterate over promises serially | ||
```js | ||
const pEachSeries = require('p-each-series'); | ||
import pEachSeries from 'p-each-series'; | ||
@@ -27,6 +27,4 @@ const keywords = [ | ||
(async () => { | ||
console.log(await pEachSeries(keywords, iterator)); | ||
//=> ['unicorn', 'rainbow', 'pony'] | ||
})(); | ||
console.log(await pEachSeries(keywords, iterator)); | ||
//=> ['unicorn', 'rainbow', 'pony'] | ||
``` | ||
@@ -57,3 +55,3 @@ | ||
```js | ||
const pEachSeries = require('p-each-series'); | ||
import pEachSeries from 'p-each-series'; | ||
@@ -60,0 +58,0 @@ // Logs `a` and `b`. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Yes
5943
57
77