package
Set a function's name property
npm install set-function-nameGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Set a function’s name.
Arguments:
fn: the functionname: the new nameloose: Optional. If true, and the name fails to be set, do not throw. Default false.Returns fn.
var setFunctionName = require('set-function-name');
var assert = require('assert');
const obj = {
concise() {},
arrow: () => {},
named: function named() {},
anon: function () {},
};
assert.equal(obj.concise.name, 'concise');
assert.equal(obj.arrow.name, 'arrow');
assert.equal(obj.named.name, 'named');
assert.equal(obj.anon.name, 'anon');
assert.equal
ljharb
ljharb@gmail.com
Estimated unpacked size across 7 packages.
105.1 kB
Includes dependencies.
4 direct dependencies.
^1.3.0
1.3.0
^1.1.4
1.1.4
^1.2.3
1.2.3
^1.0.2
1.0.2