Skip to content

Commit

Permalink
deps: p-map@7.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Dec 12, 2024
1 parent 28e8761 commit aabf345
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
20 changes: 16 additions & 4 deletions node_modules/p-map/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default async function pMap(
signal,
} = {},
) {
return new Promise((resolve, reject_) => {
return new Promise((resolve_, reject_) => {
if (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) {
throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof iterable})`);
}
Expand All @@ -30,20 +30,32 @@ export default async function pMap(
let currentIndex = 0;
const iterator = iterable[Symbol.iterator] === undefined ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();

const signalListener = () => {
reject(signal.reason);
};

const cleanup = () => {
signal?.removeEventListener('abort', signalListener);
};

const resolve = value => {
resolve_(value);
cleanup();
};

const reject = reason => {
isRejected = true;
isResolved = true;
reject_(reason);
cleanup();
};

if (signal) {
if (signal.aborted) {
reject(signal.reason);
}

signal.addEventListener('abort', () => {
reject(signal.reason);
});
signal.addEventListener('abort', signalListener, {once: true});
}

const next = async () => {
Expand Down
2 changes: 1 addition & 1 deletion node_modules/p-map/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "p-map",
"version": "7.0.2",
"version": "7.0.3",
"description": "Map over promises concurrently",
"license": "MIT",
"repository": "sindresorhus/p-map",
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"npm-profile": "^11.0.1",
"npm-registry-fetch": "^18.0.2",
"npm-user-validate": "^3.0.0",
"p-map": "^7.0.2",
"p-map": "^7.0.3",
"pacote": "^21.0.0",
"parse-conflict-json": "^4.0.0",
"proc-log": "^5.0.0",
Expand Down Expand Up @@ -12769,9 +12769,9 @@
}
},
"node_modules/p-map": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.2.tgz",
"integrity": "sha512-z4cYYMMdKHzw4O5UkWJImbZynVIo0lSGTXc7bzB1e/rrDqkgGUNysK/o4bTr+0+xKvvLoTyGqYC4Fgljy9qe1Q==",
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.3.tgz",
"integrity": "sha512-VkndIv2fIB99swvQoA65bm+fsmt6UNdGeIB0oxBs+WhAhdh08QA04JXpI7rbB9r08/nkbysKoya9rtDERYOYMA==",
"inBundle": true,
"license": "MIT",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"npm-profile": "^11.0.1",
"npm-registry-fetch": "^18.0.2",
"npm-user-validate": "^3.0.0",
"p-map": "^7.0.2",
"p-map": "^7.0.3",
"pacote": "^21.0.0",
"parse-conflict-json": "^4.0.0",
"proc-log": "^5.0.0",
Expand Down

0 comments on commit aabf345

Please # to comment.