Skip to content

Commit e244e64

Browse files
committedJun 30, 2023
[Refactor] Test: skip binding for a non-function value
1 parent 26a75bb commit e244e64

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed
 

‎lib/test.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,16 @@ function Test(name_, opts_, cb_) {
8888
this._objectPrintDepth = 5;
8989
}
9090

91-
for (var prop in this) {
92-
this[prop] = (function bind(self, val) {
93-
if (typeof val === 'function') {
91+
var self = this;
92+
for (var prop in self) {
93+
if (typeof self[prop] === 'function') {
94+
self[prop] = (function bind(propName) {
95+
var val = self[propName];
9496
return function bound() {
9597
return val.apply(self, arguments);
9698
};
97-
}
98-
return val;
99-
}(this, this[prop]));
99+
}(prop));
100+
}
100101
}
101102
}
102103

0 commit comments

Comments
 (0)
Please sign in to comment.