fn-name

4.0.0 • Public • Published

fn-name

Get the name of a named function

There is a 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

$ npm install fn-name

Usage

import functionName from 'fn-name';

functionName(function foo() {});
//=> 'foo'

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 4.0.0
    28
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 4.0.0
    28
  • 3.0.0
    953,780
  • 2.0.1
    1,039,847
  • 2.0.0
    19
  • 1.0.1
    19,307
  • 0.2.0
    19
  • 0.1.1
    20
  • 0.1.0
    17

Package Sidebar

Install

npm i fn-name

Weekly Downloads

601,655

Version

4.0.0

License

MIT

Unpacked Size

2.87 kB

Total Files

4

Last publish

Collaborators

  • sindresorhus