# fn-name

> Get the name of a named function

Latest version **4.0.0** (published 2021-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install fn-name
pnpm add fn-name
yarn add fn-name
bun add fn-name
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2021-04-07 |
| First published | 2013-12-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 34 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | function, func, fn, name |

## Links

- npm: https://www.npmjs.com/package/fn-name
- Repository: https://github.com/sindresorhus/fn-name
- Homepage: https://github.com/sindresorhus/fn-name#readme
- Issues: https://github.com/sindresorhus/fn-name/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/fn-name

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 4.0.0 (latest) — 2021-04-07
- 3.0.0 — 2019-09-10
- 2.0.1 — 2015-09-25
- 2.0.0 — 2014-11-27
- 1.0.1 — 2014-08-13
- 0.2.0 — 2014-04-29
- 0.1.1 — 2014-04-29
- 0.1.0 — 2013-12-01

## README

# fn-name

> Get the name of a named function

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

```
$ npm install fn-name
```

## Usage

```js
import functionName from 'fn-name';

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

---

<div align="center">
	<b>
		<a href="https://tidelift.com/subscription/pkg/npm-fn-name?utm_source=npm-fn-name&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
	</b>
	<br>
	<sub>
		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
	</sub>
</div>

---
_Source: https://npm.io/package/fn-name · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
