GitXplorerGitXplorer
J

Function.name

public
53 stars
3 forks
0 issues

Commits

List of commits on branch master.
Unverified
58b314d4a983110c3682f1228f845d39ccca1817

v1.0.6

JJamesMGreene committed 7 years ago
Unverified
35ee5b30b54bd789bc7d85e91e1f93a3b885e8d5

v1.0.5

JJamesMGreene committed 8 years ago
Unverified
3e447158cdeaf0024cb62c9bbc8a548844dad85d

Nah... make it configurable again

JJamesMGreene committed 8 years ago
Unverified
09cea6183ecc5da1140a5b4a9e4b0420d65919df

v1.0.4

JJamesMGreene committed 8 years ago
Unverified
ea5e1d546825599f17edb86d00db4d306d03d8e5

Simplifying the matching RegExp

JJamesMGreene committed 8 years ago
Unverified
2fa582f3d14f292ed2c4ec6f75e5ee879fc2e4e4

v1.0.3

JJamesMGreene committed 8 years ago

README

The README file for this repository.

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