Skip to content

Commit 44e2d34

Browse files
committed
Opt for better handling of keyName.
Attempt to infer the keyName from the name of the function, however in that absence, pass down the parentKeyName.
1 parent c9e853d commit 44e2d34

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function processExports(exports, test, cached, parentKeyName) {
4646
// is asynchronous.
4747
if (test) {
4848
// Pass the function itself, its keyName, and the parent keyName.
49-
if (!test(exports, keyName, parentKeyName)) {
49+
if (!test(exports, exports.name || parentKeyName)) {
5050
return exports;
5151
}
5252
}

test/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ describe("Promisify", function() {
9898
a: function a() { arguments[0](); }
9999
};
100100

101-
promisify(Test, function(func, keyName, parentKeyName) {
102-
return func.name === "a";
101+
promisify(Test, function(func, keyName) {
102+
return keyName === "a";
103103
});
104104

105105
return new Test().a();

0 commit comments

Comments
 (0)