Get the name of the function.
npm install get-function-name-x href="https://travis-ci.org/Xotic750/get-function-name-x"
title="Travis status"> src="https://travis-ci.org/Xotic750/get-function-name-x.svg?branch=master"
alt="Travis status" height="18">
href="https://david-dm.org/Xotic750/get-function-name-x"
title="Dependency status"> alt="Dependency status" height="18"/>
href="https://david-dm.org/Xotic750/get-function-name-x?type=dev"
title="devDependency status"> alt="devDependency status" height="18"/>
href="https://badge.fury.io/js/get-function-name-x"
title="npm version"> alt="npm version" height="18">
href="https://www.jsdelivr.com/package/npm/get-function-name-x"
title="jsDelivr hits"> alt="jsDelivr hits" height="18">
href="https://bettercodehub.com/results/Xotic750/get-function-name-x"
title="bettercodehub score"> alt="bettercodehub score" height="18">
href="https://coveralls.io/github/Xotic750/get-function-name-x?branch=master"
title="Coverage Status"> alt="Coverage Status" height="18">
Get the name of the function.
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
``js
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'
``