Socket
Socket
Sign inDemoInstall

function.name-polyfill

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    function.name-polyfill

Polyfill for the basic functionality of `Function.name` accessor property in its pre-ES6 form


Version published
Weekly downloads
67K
increased by2.41%
Maintainers
1
Install size
7.42 kB
Created
Weekly downloads
 

Readme

Source

Function.name

Overview

A polyfill for the basic functionality of Function.name accessor property in its pre-ES6 form.

Usage

Named function declarations

function hello() {
  /* ... */
}
console.log(hello.name);  // "hello"

Named function expressions

var fn = function foo() {
  /* ... */
};
console.log(fn.name);  // "foo"

Browser Compatibility

Most modern browsers have already supported this basic functionality for quite some time but this polyfill will apply to at least the following:

  • IE >=9 <12
  • Chrome <33

For IE <9, you can still use fn._name() instead.

Caveats

Pre-ES6 Form
  • In short, this means that this polyfilled name accessor property can provide you with the name of a named function definition (either a named function declaration or a named function expression).
  • Unlike other browsers with a similar support level for the pre-ES6 form, this poyfilled name accessor property is also intentionally marked as configurable.
Chrome <5

Other Documentation

Keywords

FAQs

Last updated on 16 May 2018

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.

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