aboutsummaryrefslogtreecommitdiff
path: root/node_modules/fn-name/readme.md
blob: 6c51f88ef8ebe61a8b56f4b4c3be2dd77a08bcc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# fn-name [![Build Status](https://travis-ci.org/sindresorhus/fn-name.svg?branch=master)](https://travis-ci.org/sindresorhus/fn-name)

> Get the name of a named function

There is a non-standard [name](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name) property 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

```sh
$ npm install --save fn-name
```


## Usage

```js
fnName(function foo() {});
//=> foo
```


## License

MIT © [Sindre Sorhus](http://sindresorhus.com)