Gathering detailed insights and metrics for escape-goat
Gathering detailed insights and metrics for escape-goat
Gathering detailed insights and metrics for escape-goat
Gathering detailed insights and metrics for escape-goat
&🐐; Escape a string for use in HTML or the inverse
npm install escape-goat
99.4
Supply Chain
84.1
Quality
75.6
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
521 Stars
31 Commits
32 Forks
7 Watching
1 Branches
9 Contributors
Updated on 26 Nov 2024
Minified
Minified + Gzipped
JavaScript (87.04%)
TypeScript (12.96%)
Cumulative downloads
Total Downloads
Last day
-11%
1,169,887
Compared to previous day
Last week
-0.8%
7,031,793
Compared to previous week
Last month
13.4%
28,789,044
Compared to previous month
Last year
-1.2%
294,906,916
Compared to previous year
Escape a string for use in HTML or the inverse
$ npm install escape-goat
1import {htmlEscape, htmlUnescape} from 'escape-goat'; 2 3htmlEscape('🦄 & 🐐'); 4//=> '🦄 & 🐐' 5 6htmlUnescape('🦄 & 🐐'); 7//=> '🦄 & 🐐' 8 9htmlEscape('Hello <em>World</em>'); 10//=> 'Hello <em>World</em>' 11 12const url = 'https://sindresorhus.com?x="🦄"'; 13 14htmlEscape`<a href="${url}">Unicorn</a>`; 15//=> '<a href="https://sindresorhus.com?x="🦄"">Unicorn</a>' 16 17const escapedUrl = 'https://sindresorhus.com?x="🦄"'; 18 19htmlUnescape`URL from HTML: ${escapedUrl}`; 20//=> 'URL from HTML: https://sindresorhus.com?x="🦄"'
Escapes the following characters in the given string
argument: &
<
>
"
'
The function also works as a tagged template literal that escapes interpolated values.
Note: This method of escaping is only safe when inserting data into normal tags like body
, div
, p
, b
, td
, etc. Inserting htmlEscape
'd data into tags like script
and style
opens your app to XSS vulnerabilities.
Unescapes the following HTML entities in the given htmlString
argument: &
<
>
"
'
The function also works as a tagged template literal that unescapes interpolated values.
Ensure you always quote your HTML attributes to prevent possible XSS.
I couldn't find one I liked that was tiny, well-tested, and had both escape and unescape methods.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 12/30 approved changesets -- score normalized to 4
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
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
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