function.prototype.name (1.1.8)

Published 2026-02-24 13:57:08 +00:00 by atheaadmin

Installation

registry=
npm install function.prototype.name@1.1.8
"function.prototype.name": "1.1.8"

About this package

function.prototype.name Version Badge

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:

  • Safari: v4 - v15 (4, 5, 5.1, 6.0.5, 6.2, 7.1, 8, 9.1.3, 10.1.2, 11.1.2, 12.1, 13.1.2, 14.1.2, 15.3, 15.6.1)
  • Chrome: v15 - v81, v83 - v106(every integer version)
    • Note: This includes Edge v80+ and Opera v15+, which matches Chrome
  • Firefox: v3, v3.6, v4 - v105 (every integer version)
    • Note: in v42 - v63, Function.prototype.toString throws on HTML element constructors, or a Proxy to a function
    • Note: in v20 - v35, HTML element constructors are not callable, despite having typeof function
  • IE: v6 - v11(every integer version
  • Opera: v11.1, v11.5, v11.6, v12.0, v12.1, v12.14, v12.15, v12.16, v15+ v15+ matches Chrome

Tests

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

Dependencies

Dependencies

ID Version
call-bind ^1.0.8
call-bound ^1.0.3
define-properties ^1.2.1
functions-have-names ^1.2.3
hasown ^2.0.2
is-callable ^1.2.7

Development Dependencies

ID Version
@es-shims/api ^2.5.1
@ljharb/eslint-config ^21.1.1
auto-changelog ^2.5.0
eclint ^2.8.1
encoding ^0.1.13
eslint =8.8.0
for-each ^0.3.3
has-strict-mode ^1.0.1
in-publish ^2.0.1
make-arrow-function ^1.2.0
make-async-function ^1.0.0
make-generator-function ^2.0.0
npmignore ^0.3.1
nyc ^10.3.2
safe-publish-latest ^2.0.0
tape ^5.9.0
uglify-register ^1.0.1

Keywords

Function.prototype.name function name ES6 ES2015 shim polyfill es-shim API
Details
npm
2026-02-24 13:57:08 +00:00
1
Jordan Harband
MIT
latest
9.2 KiB
Assets (1)
Versions (1) View all
1.1.8 2026-02-24