Skip to content

Commit 9f60d4e

Browse files
committed
feat: add name to makeCallable function
1 parent 0e890fd commit 9f60d4e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/callable.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class Callable extends Function {
5252
}
5353
}
5454

55-
export function makeCallable ( instance, method ) {
55+
export function makeCallable ( instance, method, { name } = {} ) {
5656
const config = {
5757
instance,
5858
method,
@@ -61,5 +61,10 @@ export function makeCallable ( instance, method ) {
6161
return config;
6262
};
6363

64+
Object.defineProperty( target, "name", {
65+
"value": name || method,
66+
"configurable": true,
67+
} );
68+
6469
return new Proxy( target, PROXY );
6570
}

0 commit comments

Comments
 (0)