3.1.2 • Published 6 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
6 years ago
3.1.1
6 years ago
3.1.0
6 years ago
3.0.14
6 years ago
3.0.13
6 years ago
3.0.12
6 years ago
3.0.11
6 years ago
3.0.10
6 years ago
3.0.9
6 years ago
3.0.8
6 years ago
3.0.7
6 years ago
3.0.6
6 years ago
3.0.5
6 years ago
3.0.4
6 years ago
3.0.3
6 years ago
3.0.2
6 years ago
3.0.1
6 years ago
3.0.0
6 years ago
2.1.0
8 years ago
2.0.5
8 years ago
2.0.4
8 years ago
2.0.3
8 years ago
2.0.1
8 years ago
2.0.0
8 years ago
1.2.0
8 years ago
1.1.1
8 years ago
1.1.0
8 years ago
1.0.11
9 years ago
1.0.10
9 years ago
1.0.9
9 years ago
1.0.8
10 years ago
1.0.7
10 years ago
1.0.6
10 years ago
1.0.5
10 years ago
1.0.4
10 years ago
1.0.3
10 years ago
1.0.2
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago