function.prototype.name <sup>Version Badge</sup>

dependency status dev dependency status License Downloads

npm badge

An ES2015 spec-compliant Function.prototype.name shim. Invoke its "shim" method to shim Function.prototype.name if it is unavailable. Note: Function#name requires a true ES5 environment - specifically, one with ES5 getters.

This package implements the es-shim API interface. It works in an ES5-supported environment and complies with the spec.

Most common usage:

Example

var functionName = require('function.prototype.name');
var assert = require('assert');

assert.equal(functionName(function foo() {}), 'foo');

functionName.shim();
assert.equal(function foo() {}.name, 'foo');

Supported engines

Automatically tested in every minor version of node.

Manually tested in:

Tests

Simply clone the repo, npm install, and run npm test

function.prototype.name - Installation

To install function.prototype.name via this registry, you'll need to install via the --registry parameter with your package manager.

n

NPM

npm install function.prototype.name --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Yarn

yarn config set registry https://js.registry.sudovanilla.org
yarn install function.prototype.name

Learn more about the config option.

PNPM

pnpm install function.prototype.name --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Bun Logo

Bun

bun install function.prototype.name --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Learn more about setting this up in your bunfig.toml configuration.


For Deno, add the following to your .npmrc file in your directory:

registry="https://js.registry.sudovanilla.org"

Then run the deno install command.

function.prototype.name - Download

Download Tarball (v1.1.8)

Integrity sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==
SHASUM e68e1df7b259a5c949eeef95cdbde53edffabb78
Tarball https://js.registry.sudovanilla.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz