Skip to content

Commit 9d64976

Browse files
committed
fix(autobind): ensure key comparison handles non-string types correctly
1 parent 7ded4c8 commit 9d64976

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/utils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ export const autobind = (self = {}) => {
6363
];
6464

6565
const filter = (key) => {
66+
const keyString = typeof key === 'string' ? key : String(key);
6667
const match = (pattern) =>
67-
typeof pattern === "string" ? key === pattern : pattern.test(key);
68+
typeof pattern === "string"
69+
? keyString === pattern
70+
: pattern.test(keyString);
6871
if (exclude) {
6972
return !exclude.some(match);
7073
}

0 commit comments

Comments
 (0)