Category
The class to use as the first part of the name
Rest
...args: any[]The method to use as the second part of the name
A string name for the method
Object
class Class {
static staticMethod() {}
}
name(Class, Class.staticMethod); // 'Class.staticMethod'
class Class {
instanceMethod() {}
}
name(Class, Class.prototype.instanceMethod); // 'Class#instanceMethod'
Category
Get the name of a function or class.
Time complexity: O(1)
Space complexity: O(1)
The function or class to get the name for
The name of func
Object
function func() {}
name(func); // 'func'
class Class {}
name(Class); // 'Class'
Get a string name for a class method.
Time complexity: O(1)
Space complexity: O(1)