| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,7 +23,6 @@ const { | |||
| 23 | 23 | ObjectKeys, | |
| 24 | 24 | ObjectValues, | |
| 25 | 25 | Promise, | |
| 26 | - PromisePrototypeCatch, | ||
| 27 | 26 | PromisePrototypeThen, | |
| 28 | 27 | PromiseResolve, | |
| 29 | 28 | ReflectGetOwnPropertyDescriptor, | |
@@ -653,8 +652,8 @@ function createRepl(inspector) { | |||
| 653 | 652 | } | |
| 654 | 653 | ||
| 655 | 654 | const inspectValue = (expr) => | |
| 656 | - PromisePrototypeCatch(evalInCurrentContext(expr), | ||
| 657 | - (error) => `<${error.message}>`); | ||
| 655 | + PromisePrototypeThen(evalInCurrentContext(expr), undefined, | ||
| 656 | + (error) => `<${error.message}>`); | ||
| 658 | 657 | const lastIndex = watchedExpressions.length - 1; | |
| 659 | 658 | ||
| 660 | 659 | const values = await SafePromiseAll(watchedExpressions, inspectValue); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,11 +6,9 @@ const { | |||
| 6 | 6 | ArrayPrototypeEvery, | |
| 7 | 7 | ArrayPrototypeFilter, | |
| 8 | 8 | Boolean, | |
| 9 | - PromiseAll, | ||
| 10 | - PromisePrototypeCatch, | ||
| 11 | 9 | PromisePrototypeThen, | |
| 12 | 10 | PromiseReject, | |
| 13 | - SafeArrayIterator, | ||
| 11 | + SafePromiseAll, | ||
| 14 | 12 | StringPrototypeSplit, | |
| 15 | 13 | } = primordials; | |
| 16 | 14 | const { | |
@@ -128,13 +126,13 @@ function getStats(src, dest, opts) { | |||
| 128 | 126 | const statFunc = opts.dereference ? | |
| 129 | 127 | (file) => stat(file, { bigint: true }) : | |
| 130 | 128 | (file) => lstat(file, { bigint: true }); | |
| 131 | - return PromiseAll(new SafeArrayIterator([ | ||
| 129 | + return SafePromiseAll([ | ||
| 132 | 130 | statFunc(src), | |
| 133 | - PromisePrototypeCatch(statFunc(dest), (err) => { | ||
| 131 | + PromisePrototypeThen(statFunc(dest), undefined, (err) => { | ||
| 134 | 132 | if (err.code === 'ENOENT') return null; | |
| 135 | 133 | throw err; | |
| 136 | 134 | }), | |
| 137 | - ])); | ||
| 135 | + ]); | ||
| 138 | 136 | } | |
| 139 | 137 | ||
| 140 | 138 | async function checkParentDir(destStat, src, dest, opts) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,9 +13,8 @@ const { | |||
| 13 | 13 | ObjectCreate, | |
| 14 | 14 | ObjectDefineProperty, | |
| 15 | 15 | ObjectSetPrototypeOf, | |
| 16 | - PromiseAll, | ||
| 17 | 16 | RegExpPrototypeExec, | |
| 18 | - SafeArrayIterator, | ||
| 17 | + SafePromiseAll, | ||
| 19 | 18 | SafeWeakMap, | |
| 20 | 19 | StringPrototypeSlice, | |
| 21 | 20 | StringPrototypeToUpperCase, | |
@@ -525,7 +524,7 @@ class ESMLoader { | |||
| 525 | 524 | .then(({ module }) => module.getNamespace()); | |
| 526 | 525 | } | |
| 527 | 526 | ||
| 528 | - const namespaces = await PromiseAll(new SafeArrayIterator(jobs)); | ||
| 527 | + const namespaces = await SafePromiseAll(jobs); | ||
| 529 | 528 | ||
| 530 | 529 | if (!wasArr) { return namespaces[0]; } // We can skip the pairing below | |
| 531 | 530 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,11 +1,10 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | const { | |
| 4 | - ArrayPrototypeMap, | ||
| 5 | - PromiseAll, | ||
| 6 | 4 | PromisePrototypeThen, | |
| 7 | - PromisePrototypeFinally, | ||
| 8 | 5 | PromiseResolve, | |
| 6 | + SafePromiseAll, | ||
| 7 | + SafePromisePrototypeFinally, | ||
| 9 | 8 | Uint8Array, | |
| 10 | 9 | } = primordials; | |
| 11 | 10 | ||
@@ -165,7 +164,7 @@ function newWritableStreamFromStreamWritable(streamWritable) { | |||
| 165 | 164 | async write(chunk) { | |
| 166 | 165 | if (streamWritable.writableNeedDrain || !streamWritable.write(chunk)) { | |
| 167 | 166 | backpressurePromise = createDeferredPromise(); | |
| 168 | - return PromisePrototypeFinally( | ||
| 167 | + return SafePromisePrototypeFinally( | ||
| 169 | 168 | backpressurePromise.promise, () => { | |
| 170 | 169 | backpressurePromise = undefined; | |
| 171 | 170 | }); | |
@@ -246,10 +245,9 @@ function newStreamWritableFromWritableStream(writableStream, options = kEmptyObj | |||
| 246 | 245 | writer.ready, | |
| 247 | 246 | () => { | |
| 248 | 247 | return PromisePrototypeThen( | |
| 249 | - PromiseAll( | ||
| 250 | - ArrayPrototypeMap( | ||
| 251 | - chunks, | ||
| 252 | - (data) => writer.write(data.chunk))), | ||
| 248 | + SafePromiseAll( | ||
| 249 | + chunks, | ||
| 250 | + (data) => writer.write(data.chunk)), | ||
| 253 | 251 | done, | |
| 254 | 252 | done); | |
| 255 | 253 | }, | |
@@ -668,10 +666,9 @@ function newStreamDuplexFromReadableWritablePair(pair = kEmptyObject, options = | |||
| 668 | 666 | writer.ready, | |
| 669 | 667 | () => { | |
| 670 | 668 | return PromisePrototypeThen( | |
| 671 | - PromiseAll( | ||
| 672 | - ArrayPrototypeMap( | ||
| 673 | - chunks, | ||
| 674 | - (data) => writer.write(data.chunk))), | ||
| 669 | + SafePromiseAll( | ||
| 670 | + chunks, | ||
| 671 | + (data) => writer.write(data.chunk)), | ||
| 675 | 672 | done, | |
| 676 | 673 | done); | |
| 677 | 674 | }, | |
@@ -767,7 +764,7 @@ function newStreamDuplexFromReadableWritablePair(pair = kEmptyObject, options = | |||
| 767 | 764 | ||
| 768 | 765 | if (!writableClosed || !readableClosed) { | |
| 769 | 766 | PromisePrototypeThen( | |
| 770 | - PromiseAll([ | ||
| 767 | + SafePromiseAll([ | ||
| 771 | 768 | closeWriter(), | |
| 772 | 769 | closeReader(), | |
| 773 | 770 | ]), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,8 +19,8 @@ const { | |||
| 19 | 19 | PromisePrototypeThen, | |
| 20 | 20 | PromiseResolve, | |
| 21 | 21 | PromiseReject, | |
| 22 | - PromiseAll, | ||
| 23 | 22 | ReflectConstruct, | |
| 23 | + SafePromiseAll, | ||
| 24 | 24 | Symbol, | |
| 25 | 25 | SymbolAsyncIterator, | |
| 26 | 26 | SymbolToStringTag, | |
@@ -1334,7 +1334,7 @@ function readableStreamPipeTo( | |||
| 1334 | 1334 | } | |
| 1335 | 1335 | ||
| 1336 | 1336 | shutdownWithAnAction( | |
| 1337 | - async () => PromiseAll(actions.map((action) => action())), | ||
| 1337 | + () => SafePromiseAll(actions, (action) => action()), | ||
| 1338 | 1338 | true, | |
| 1339 | 1339 | error); | |
| 1340 | 1340 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,6 @@ const { | |||
| 4 | 4 | FunctionPrototypeBind, | |
| 5 | 5 | FunctionPrototypeCall, | |
| 6 | 6 | ObjectDefineProperties, | |
| 7 | - PromisePrototypeCatch, | ||
| 8 | 7 | PromisePrototypeThen, | |
| 9 | 8 | PromiseResolve, | |
| 10 | 9 | ReflectConstruct, | |
@@ -496,19 +495,17 @@ function transformStreamDefaultControllerError(controller, error) { | |||
| 496 | 495 | transformStreamError(controller[kState].stream, error); | |
| 497 | 496 | } | |
| 498 | 497 | ||
| 499 | - function transformStreamDefaultControllerPerformTransform(controller, chunk) { | ||
| 500 | - const transformPromise = | ||
| 501 | - ensureIsPromise( | ||
| 498 | + async function transformStreamDefaultControllerPerformTransform(controller, chunk) { | ||
| 499 | + try { | ||
| 500 | + return await ensureIsPromise( | ||
| 502 | 501 | controller[kState].transformAlgorithm, | |
| 503 | 502 | controller, | |
| 504 | 503 | chunk, | |
| 505 | 504 | controller); | |
| 506 | - return PromisePrototypeCatch( | ||
| 507 | - transformPromise, | ||
| 508 | - (error) => { | ||
| 509 | - transformStreamError(controller[kState].stream, error); | ||
| 510 | - throw error; | ||
| 511 | - }); | ||
| 505 | + } catch (error) { | ||
| 506 | + transformStreamError(controller[kState].stream, error); | ||
| 507 | + throw error; | ||
| 508 | + } | ||
| 512 | 509 | } | |
| 513 | 510 | ||
| 514 | 511 | function transformStreamDefaultControllerTerminate(controller) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments