|
před 1 rokem | |
---|---|---|
.. | ||
.github | před 1 rokem | |
helpers | před 1 rokem | |
test | před 1 rokem | |
.editorconfig | před 1 rokem | |
.eslintignore | před 1 rokem | |
.eslintrc | před 1 rokem | |
.nycrc | před 1 rokem | |
CHANGELOG.md | před 1 rokem | |
LICENSE | před 1 rokem | |
README.md | před 1 rokem | |
auto.js | před 1 rokem | |
implementation.js | před 1 rokem | |
index.js | před 1 rokem | |
package.json | před 1 rokem | |
polyfill.js | před 1 rokem | |
shim.js | před 1 rokem |
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:
var functionName = require('function.prototype.name');
var assert = require('assert');
assert.equal(functionName(function foo() {}), 'foo');
functionName.shim();
assert.equal(function foo() {}.name, 'foo');
Simply clone the repo, npm install
, and run npm test