Skip to content

Conversation

@littledivy
Copy link
Member

Fixes #29074

Fixes denoland#29074

Co-Authored-By: Satya Rohith <satya@deno.com>
@littledivy littledivy requested a review from satyarohith May 5, 2025 11:11
@littledivy littledivy requested a review from kt3k May 5, 2025 16:18
Signed-off-by: Satya Rohith <me@satyarohith.com>
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kt3k
Copy link
Member

kt3k commented May 5, 2025

Note: dns.lookup sets kCustomPromisifyArgsSymbol field and promisify changes the return value behavior based on number of arguments given to the callback

const argumentNames = original[kCustomPromisifyArgsSymbol];
function fn(...args) {
return new Promise((resolve, reject) => {
args.push((err, ...values) => {
if (err) {
return reject(err);
}
if (argumentNames !== undefined && values.length > 1) {
const obj = {};
for (let i = 0; i < argumentNames.length; i++) {
obj[argumentNames[i]] = values[i];
}
resolve(obj);
} else {
resolve(values[0]);
}
});
Reflect.apply(original, this, args);
});
}

@littledivy littledivy merged commit 2edc70e into denoland:main May 6, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: addressList.filter is not a function

3 participants