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
Small JavaScript library to replace string literals, regular expressions, and comments from JavaScript syntax.
npm install escaper
Typescript
Module System
Node Version
NPM Version
JavaScript (98.51%)
HTML (1.49%)
Total Downloads
6,781,328
Last Day
109
Last Week
2,125
Last Month
12,519
Last Year
192,873
MIT License
12 Stars
720 Commits
3 Watchers
4 Branches
4 Contributors
Updated on Dec 15, 2022
Minified
Minified + Gzipped
Latest Version
3.0.6
Package Id
escaper@3.0.6
Size
12.91 kB
NPM Version
6.14.8
Node Version
14.15.1
Published on
Jul 05, 2021
Cumulative downloads
Total Downloads
Last Day
-72.1%
109
Compared to previous day
Last Week
-35.8%
2,125
Compared to previous week
Last Month
-8.6%
12,519
Compared to previous month
Last Year
-10.2%
192,873
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
1bower 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 binaries found in the repo
Reason
no dangerous workflow patterns detected
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
26 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
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