A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/npm/cli/commit/890503767c733a1eacfdd562b01eb37ac253906c below:

p-map@7.0.2 · npm/cli@8905037 · GitHub

File tree Expand file treeCollapse file tree 10 files changed

+365

-350

lines changed

Filter options

Expand file treeCollapse file tree 10 files changed

+365

-350

lines changed Original file line number Diff line number Diff line change

@@ -2,7 +2,6 @@ const fetch = require('npm-registry-fetch')

2 2

const localeCompare = require('@isaacs/string-locale-compare')('en')

3 3

const npa = require('npm-package-arg')

4 4

const pacote = require('pacote')

5 -

const pMap = require('p-map')

6 5

const tufClient = require('@sigstore/tuf')

7 6

const { log, output } = require('proc-log')

8 7

@@ -26,6 +25,7 @@ class VerifySignatures {

26 25 27 26

async run () {

28 27

const start = process.hrtime.bigint()

28 +

const { default: pMap } = await import('p-map')

29 29 30 30

// Find all deps in tree

31 31

const { edges, registries } = this.getEdgesOut(this.tree.inventory.values(), this.filterSet)

Original file line number Diff line number Diff line change

@@ -61,7 +61,6 @@

61 61

!/cacache/node_modules/chownr

62 62

!/cacache/node_modules/minizlib

63 63

!/cacache/node_modules/mkdirp

64 -

!/cacache/node_modules/p-map

65 64

!/cacache/node_modules/tar

66 65

!/cacache/node_modules/yallist

67 66

!/chalk

@@ -160,6 +159,7 @@

160 159

!/node-gyp/node_modules/make-fetch-happen

161 160

!/node-gyp/node_modules/minipass-fetch

162 161

!/node-gyp/node_modules/nopt

162 +

!/node-gyp/node_modules/p-map

163 163

!/node-gyp/node_modules/proc-log

164 164

!/node-gyp/node_modules/ssri

165 165

!/node-gyp/node_modules/unique-filename

Original file line number Diff line number Diff line change

@@ -0,0 +1,81 @@

1 +

'use strict';

2 +

const AggregateError = require('aggregate-error');

3 + 4 +

module.exports = async (

5 +

iterable,

6 +

mapper,

7 +

{

8 +

concurrency = Infinity,

9 +

stopOnError = true

10 +

} = {}

11 +

) => {

12 +

return new Promise((resolve, reject) => {

13 +

if (typeof mapper !== 'function') {

14 +

throw new TypeError('Mapper function is required');

15 +

}

16 + 17 +

if (!((Number.isSafeInteger(concurrency) || concurrency === Infinity) && concurrency >= 1)) {

18 +

throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);

19 +

}

20 + 21 +

const result = [];

22 +

const errors = [];

23 +

const iterator = iterable[Symbol.iterator]();

24 +

let isRejected = false;

25 +

let isIterableDone = false;

26 +

let resolvingCount = 0;

27 +

let currentIndex = 0;

28 + 29 +

const next = () => {

30 +

if (isRejected) {

31 +

return;

32 +

}

33 + 34 +

const nextItem = iterator.next();

35 +

const index = currentIndex;

36 +

currentIndex++;

37 + 38 +

if (nextItem.done) {

39 +

isIterableDone = true;

40 + 41 +

if (resolvingCount === 0) {

42 +

if (!stopOnError && errors.length !== 0) {

43 +

reject(new AggregateError(errors));

44 +

} else {

45 +

resolve(result);

46 +

}

47 +

}

48 + 49 +

return;

50 +

}

51 + 52 +

resolvingCount++;

53 + 54 +

(async () => {

55 +

try {

56 +

const element = await nextItem.value;

57 +

result[index] = await mapper(element, index);

58 +

resolvingCount--;

59 +

next();

60 +

} catch (error) {

61 +

if (stopOnError) {

62 +

isRejected = true;

63 +

reject(error);

64 +

} else {

65 +

errors.push(error);

66 +

resolvingCount--;

67 +

next();

68 +

}

69 +

}

70 +

})();

71 +

};

72 + 73 +

for (let i = 0; i < concurrency; i++) {

74 +

next();

75 + 76 +

if (isIterableDone) {

77 +

break;

78 +

}

79 +

}

80 +

});

81 +

};

File renamed without changes.

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4