Gathering detailed insights and metrics for escaper
Gathering detailed insights and metrics for escaper
Gathering detailed insights and metrics for escaper
Gathering detailed insights and metrics for escaper
npm install escaper
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
12 Stars
720 Commits
3 Watching
4 Branches
4 Contributors
Updated on 15 Dec 2022
JavaScript (98.51%)
HTML (1.49%)
Cumulative downloads
Total Downloads
Last day
-67.7%
744
Compared to previous day
Last week
-21.8%
5,650
Compared to previous week
Last month
24.1%
23,543
Compared to previous month
Last year
-2.5%
219,558
Compared to previous year
33
Escaper is a small JavaScript library to replace string literals, regular expressions, and comments from the JavaScript syntax.
Supports:
' ... '
" ... "
` ... `
, ` ... ${...} `
/ ... /
// ...
, //* ...
, //! ...
, //# ...
, //@ ...
, //$ ...
/* ... */
, /** ... */
, /*! ... */
, /*# ... */
, /*@ ... */
, /*$ ... */
https://raw.githubusercontent.com/kobezzza/Escaper/master/dist/escaper.min.js
or
1npm install escaper
or
1git clone https://github.com/kobezzza/Escaper
1const 2 str = 'Hello "world" and \'friends\'', 3 content = []; 4 5// Replaces all found matches 6// 'Hello __ESCAPER_QUOT__0_ and __ESCAPER_QUOT__1_' 7Escaper.replace(str, content) 8 9// Replaces only single quotes 10// 'Hello "world" and __ESCAPER_QUOT__0_' 11Escaper.replace(str, ["'"]) 12 13// Cuts all found matches 14// 'Hello and ' 15Escaper.replace(str, -1) 16 17// Replaces all and cuts single quotes 18// 'Hello __ESCAPER_QUOT__0_ and ' 19Escaper.replace(str, {"'": -1}) 20 21// Replaces all but strings 22// 'Hello __ESCAPER_QUOT__0_ and \'friends\'' 23Escaper.replace(str, {strings: false}) 24 25// Replaces all, but strings can be only single quotes 26// 'Hello "world" and __ESCAPER_QUOT__0_' 27Escaper.replace(str, {strings: ["'"]}) 28 29// Replaces all, but strings can be only single quotes and it will be cut 30// 'Hello "world" and ' 31Escaper.replace(str, {strings: {"'": -1}}) 32 33// Replaces all found escape blocks to a real content 34// 'Hello "world" and \'friends\'' 35Escaper.paste(str, content);
Replaces all found blocks ' ... '
, " ... "
, ` ... `
, / ... /
, // ...
, /* ... */
to
escape blocks from the specified string and returns a new string.
Arguments
string
str
— source string;string[] | Record<string, string[] | Record<string, boolean | -1> | false | -1> | false | -1
how?
— parameters:Possible values
If a value is set to -1
, then all found matches will be removed from the final string.
If the value is set to boolean
it will be replaced/passed.
1// Label of replacement, by default __ESCAPER_QUOT__${pos}_ 2'label' 3 4// Singleline comment 5'singleComments' 6 7// Multiline comments 8'multComments' 9 10// All kinds of comments 11'comments' 12 13// All kinds of strings 14'strings' 15 16// All kinds of literals (except strings and comments) 17'literals' 18 19// Literals 20"'" 21'"' 22'`' 23'/' 24'//' 25'//*' 26'//!' 27'//#' 28'//@' 29'//$' 30'/*' 31'/**' 32'/*!' 33'/*#' 34'/*@' 35'/*$'
The parameters can be specified as an array (escapes only explicitly specified sequences)
or like an object (disables/excludes by a literal or group). Also, if you set the parameter value as -1
,
then all found sequences will be removed from the string.
string[]
store = Escaper.content
— store for matches.Replaces all found escape blocks to real content from the specified string and returns a new string.
Arguments
string
str
— source string;string[]
store = Escaper.content
— store of matches;RegExp
rgxp?
— RegExp to search, e.g. /__ESCAPER_QUOT__(\d+)_/g
.The MIT License.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
Found 0/20 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
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
24 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
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