MCPcopy Index your code
hub / github.com/nodejs/node / fn

Function fn

lib/internal/util.js:477–497  ·  view source on GitHub ↗
(...args)

Source from the content-addressed store, hash-verified

475 const argumentNames = original[kCustomPromisifyArgsSymbol];
476
477 function fn(...args) {
478 return new Promise((resolve, reject) => {
479 ArrayPrototypePush(args, (err, ...values) => {
480 if (err) {
481 return reject(err);
482 }
483 if (argumentNames !== undefined && values.length > 1) {
484 const obj = {};
485 for (let i = 0; i < argumentNames.length; i++)
486 obj[argumentNames[i]] = values[i];
487 resolve(obj);
488 } else {
489 resolve(values[0]);
490 }
491 });
492 if (isPromise(ReflectApply(original, this, args))) {
493 process.emitWarning('Calling promisify on a function that returns a Promise is likely a mistake.',
494 'DeprecationWarning', 'DEP0174');
495 }
496 });
497 }
498
499 ObjectSetPrototypeOf(fn, ObjectGetPrototypeOf(original));
500

Callers 15

cachedResultFunction · 0.70
suspendReplWhileMethod · 0.50
createDynamicModuleFunction · 0.50
serializeValueFunction · 0.50
safeCallbackInvokeFunction · 0.50
invokeOnerrorFunction · 0.50
findVFSWithFunction · 0.50
vfsOpFunction · 0.50
vfsOpVoidFunction · 0.50
minimalRunCjsFunction · 0.50
finishImplFunction · 0.50
fromAsyncGenFunction · 0.50

Calls 2

rejectFunction · 0.50
resolveFunction · 0.50

Tested by

no test coverage detected