Socket
Socket
Sign inDemoInstall

function.prototype.name

Package Overview
Dependencies
59
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

function.prototype.name

An ES2015 spec-compliant `Function.prototype.name` shim

    1.1.6latest
    GitHub
    npm

Version published
Maintainers
1
Weekly downloads
26,727,727
increased by4.34%

Weekly downloads

Changelog

Source

v1.1.6 - 2023-08-28

Commits

<!-- auto-changelog-above -->

1.1.5 / 2021-10-01

  • [Deps] update es-abstract
  • [meta] use prepublishOnly script for npm 7+
  • [Dev Deps] update eslint, @ljharb/eslint-config, @es-shims/api, aud, tape
  • [actions] update workflows
  • [actions] use node/install instead of node/run; use codecov action

1.1.4 / 2021-02-22

  • [readme] remove travis badge
  • [meta] remove audit-level
  • [meta] gitignore coverage output
  • [meta] do not publish github action workflow files
  • [Deps] update call-bind, es-abstract, functions-have-names
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, has-strict-mode, tape
  • [Tests] increase coverage
  • [actions] update workflows

1.1.3 / 2020-11-27

  • [Deps] update es-abstract, functions-have-names; use call-bind where applicable
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape, make-arrow-function, make-generator-function; add aud, make-async-function
  • [actions] add "Allow Edits" workflow
  • [actions] switch Automatic Rebase workflow to pull_request_target event
  • [Tests] migrate tests to Github Actions
  • [Tests] run nyc on all tests
  • [Tests] add implementation test; run es-shim-api in postlint; use tape runner
  • [Tests] only audit prod deps

1.1.2 / 2019-12-14

  • [Refactor] use es-abstract
  • [Deps] update functions-have-names
  • [meta] add funding field
  • [meta] fix repo capitalization
  • [Dev Deps] update eslint, @ljharb/eslint-config, safe-publish-latest
  • [Tests] use shared travis-ci configs
  • [actions] add automatic rebasing / merge commit blocking

1.1.1 / 2019-07-24

  • [Refactor] use functions-have-names
  • [meta] clean up package.json scripts
  • [meta] update links
  • [meta] create FUNDING.yml
  • [Deps] update is-callable, define-properties
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape, safe-publish-latest, covert
  • [Tests] use eccheck over editorconfig-tools
  • [Tests] use npx aud instead of nsp or npm audit with hoops
  • [Tests] up to node v11.7, v10.15, v9.11, v8.15, v6.16, v4.9
  • [Test] remove jscs

1.1.0 / 2017-12-31

  • [New] add auto entry point
  • [Deps] update function-bind
  • [Dev Deps] update uglify-register, tape, nsp, eslint, @ljharb/eslint-config, @es-shims/api
  • [Tests] up to node v9.3, v8.9, v6.12; use nvm install-latest-npm; pin included builds to LTS

1.0.3 / 2017-07-21

  • [Fix] be robust against function name mangling
  • [Refactor] move function name detection to separate file

1.0.2 / 2017-07-14

  • [Refactor] shim: Remove unnecessary !functionsHaveNames check

1.0.1 / 2017-07-11

  • [Fix] in IE 9-11, we must rely on .call being available (#13)
  • [Fix] ensure that Function.prototype.name does not erase the getter
  • [Deps] update is-callable
  • [Dev Deps] add safe-publish-latest
  • [Dev Deps] update tape, jscs, nsp, eslint, @ljharb/eslint-config, @es-shims/api
  • [Tests] up to node v8.1; v7.10, v6.11, v4.8; improve matrix; newer npm fails on older nodes
  • [Tests] use Object to avoid function name inference in node 7

1.0.0 / 2016-02-27

  • Initial release.

Readme

Source

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

Keywords

FAQs

Last updated on 28 Aug 2023

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc