fn-name

Get the name of a named function

npm install fn-name
15 downloads in the last month

function-name Build Status

Get the name of a named function

There is a non-standard property .name on functions, but it's not supported in all browsers. This module tries that property then falls back to extracting the name from the function source.

Install

Download manually or with a package-manager.

npm

npm install --save fn-name

Bower

bower install --save function-name

Component

component install sindresorhus/function-name

Examples

Node.js

var functionName = require('function-name');
functionName(function foo() {});
//=> foo

Bower

<script src="bower_components/function-name/function-name.js"></script>
functionName(function foo() {});
//=> foo

License

MIT © Sindre Sorhus

npm loves you