3.1.2 • Published 5 years ago
get-function-name-x v3.1.2
get-function-name-x
Get the name of the function.
module.exports(fn)
⇒ undefined | string ⏏
This method returns the name of the function, or undefined
if not
a function.
Kind: Exported function
Returns: undefined | string - The name of the function, or undefined
if
not a function.
Param | Type | Description |
---|---|---|
fn | function | The function to get the name of. |
Example
import getFunctionName from 'get-function-name-x';
console.log(getFunctionName()); // undefined
console.log(getFunctionName(Number.MIN_VALUE)); // undefined
console.log(getFunctionName('abc')); // undefined
console.log(getFunctionName(true)); // undefined
console.log(getFunctionName({name: 'abc'})); // undefined
console.log(getFunctionName(function() {})); // ''
console.log(getFunctionName(new Function())); // ''
console.log(getFunctionName(function test1() {})); // 'test1'
console.log(getFunctionName(function* test2() {})); // 'test2'
console.log(getFunctionName(class Test {});) // 'Test'
3.1.2
5 years ago
3.1.1
5 years ago
3.1.0
5 years ago
3.0.14
5 years ago
3.0.13
5 years ago
3.0.12
5 years ago
3.0.11
5 years ago
3.0.10
5 years ago
3.0.9
5 years ago
3.0.8
5 years ago
3.0.7
5 years ago
3.0.6
5 years ago
3.0.5
5 years ago
3.0.4
5 years ago
3.0.3
5 years ago
3.0.2
5 years ago
3.0.1
5 years ago
3.0.0
5 years ago
2.1.0
7 years ago
2.0.5
7 years ago
2.0.4
7 years ago
2.0.3
7 years ago
2.0.1
7 years ago
2.0.0
7 years ago
1.2.0
7 years ago
1.1.1
7 years ago
1.1.0
7 years ago
1.0.11
8 years ago
1.0.10
8 years ago
1.0.9
8 years ago
1.0.8
8 years ago
1.0.7
8 years ago
1.0.6
8 years ago
1.0.5
8 years ago
1.0.4
8 years ago
1.0.3
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago