Gathering detailed insights and metrics for code-excerpt
Gathering detailed insights and metrics for code-excerpt
Gathering detailed insights and metrics for code-excerpt
Gathering detailed insights and metrics for code-excerpt
npm install code-excerpt
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
8 Stars
29 Commits
1 Forks
3 Watching
1 Branches
2 Contributors
Updated on 18 Jun 2022
JavaScript (69.3%)
TypeScript (30.7%)
Cumulative downloads
Total Downloads
Last day
3.9%
220,557
Compared to previous day
Last week
5.7%
1,168,834
Compared to previous week
Last month
12%
4,873,141
Compared to previous month
Last year
56.9%
44,110,181
Compared to previous year
1
Extract code excerpts
$ npm install --save code-excerpt
1import codeExcerpt from 'code-excerpt'; 2 3const source = ` 4'use strict'; 5 6function someFunc() {} 7 8module.exports = () => { 9 const a = 1; 10 const b = 2; 11 const c = 3; 12 13 someFunc(); 14}; 15`.trim(); 16 17const excerpt = codeExcerpt(source, 5); 18//=> [ 19// {line: 2, value: ''}, 20// {line: 3, value: 'function someFunc() {}'}, 21// {line: 4, value: ''}, 22// {line: 5, value: 'module.exports = () => {'}, 23// {line: 6, value: ' const a = 1;'}, 24// {line: 7, value: ' const b = 2;'}, 25// {line: 8, value: ' const c = 3;'} 26// ]
Type: string
Source code.
Type: number
Line number to extract excerpt for.
Type: number
Default: 3
Number of surrounding lines to extract.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
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
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
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