getfunctionname

Get the name of a function

Usage no npm install needed!

<script type="module">
  import getfunctionname from 'https://cdn.skypack.dev/getfunctionname';
</script>

README

getfunctionname

Get the readable name of a function.

Installation

$ npm install getfunctionname

Usage

var getFunctionName = require('getfunctionname');

getFunctionName(function someFunction () { }); // 'someFunction'
getFunctionName(function ANOTHER_FUNCTION () { }); // 'ANOTHER_FUNCTION'

getFunctionName(() => { }); // 'anonymous'
getFunctionName(function () { }); // 'anonymous'

License

MIT