You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Sign inDemoInstall

Package Overview
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies


An ES2015 spec-compliant `` shim

Version published
Weekly downloads
decreased by-18.93%
Install size
4.05 MB
Weekly downloads



v1.1.6 - 2023-08-28


<!-- 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 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.


Source Version Badge

dependency status dev dependency status License Downloads

npm badge

An ES2015 spec-compliant shim. Invoke its "shim" method to shim 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:


var functionName = require('');
var assert = require('assert');

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

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


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



Package last updated on 28 Aug 2023

Did you know?


Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.


Related posts

SocketSocket SOC 2 Logo


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


Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc