sorensen / get-function-name.js

Get the name of a function
MIT License
0 stars 1 forks source link

get-function-name

Get the name of a function

Install

With npm

npm install get-function-name

Usage

Node.js

var getFunctionName = require('get-function-name')

var foo = function() {}
function bar() {}

getFunctionName(foo) // 'anonymous'
getFunctionName(bar) // 'bar'
getFunctionName('hello') // null