Gathering detailed insights and metrics for set-function-name
Gathering detailed insights and metrics for set-function-name
Gathering detailed insights and metrics for set-function-name
Gathering detailed insights and metrics for set-function-name
npm install set-function-name
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
4 Stars
26 Commits
1 Forks
4 Watching
2 Branches
2 Contributors
Updated on 28 Sept 2023
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-4.3%
4,907,767
Compared to previous day
Last week
2.3%
27,914,770
Compared to previous week
Last month
7.1%
116,828,190
Compared to previous month
Last year
776.5%
1,119,377,957
Compared to previous year
31
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
.
1var setFunctionName = require('set-function-name'); 2var assert = require('assert'); 3 4const obj = { 5 concise() {}, 6 arrow: () => {}, 7 named: function named() {}, 8 anon: function () {}, 9}; 10assert.equal(obj.concise.name, 'concise'); 11assert.equal(obj.arrow.name, 'arrow'); 12assert.equal(obj.named.name, 'named'); 13assert.equal(obj.anon.name, 'anon'); 14 15assert.equal(setFunctionName(obj.concise, 'brief'), obj.concise); 16assert.equal(setFunctionName(obj.arrow, 'pointy'), obj.arrow); 17assert.equal(setFunctionName(obj.named, ''), obj.named); 18assert.equal(setFunctionName(obj.anon, 'anonymous'), obj.anon); 19 20assert.equal(obj.concise.name, 'brief'); 21assert.equal(obj.arrow.name, 'pointy'); 22assert.equal(obj.named.name, ''); 23assert.equal(obj.anon.name, 'anonymous');
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
security policy file detected
Details
Reason
Found 0/26 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More