Gathering detailed insights and metrics for encode-entities
Gathering detailed insights and metrics for encode-entities
Gathering detailed insights and metrics for encode-entities
Gathering detailed insights and metrics for encode-entities
🏃♂️ Fast and simple Map and RegExp based HTML entities encoder.🍁
npm install encode-entities
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
83 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Jul 07, 2024
Latest Version
1.1.2
Package Id
encode-entities@1.1.2
Unpacked Size
9.34 kB
Size
3.23 kB
File Count
7
NPM Version
10.8.1
Node Version
22.3.0
Published on
Jun 29, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
5
🏃♂️ Fast and simple Map and RegExp based HTML entities encoder.🍁
This package has been deprecated, please use @igor.dvlpr/encode-entities instead.
Fast and simple Map and RegExp based HTML entities encoder. In order to overcome different methods of possible XSS attacks, it by default encodes the following characters: <, >, ", ', &, =, `, !, @, $, %, (, ), +, {, }, [, ].
You can however remove any of these rules and/or add your own.
Uses the MappedReplacer package.
✨Since version 1.1.0
Encode Entities
is a hybrid module that supports both CommonJS (legacy) and ES modules, thanks to Modern Module.
1npm i encode-entities
Resets the rules to the default ones.
1const Encoder = require('encode-entities') 2 3const encoder = new Encoder() 4 5encoder.addRule('<', '😀') 6encoder.addRule('>', '😂') 7encoder.resetRules() 8 9console.log(encoder.encode('<strong>')) // outputs '<strong>'
Adds a new rule or updates the existing rule for entities encoding. Returns true if the rule was added successfully or false if not.
1const Encoder = require('encode-entities') 2 3const encoder = new Encoder() 4 5encoder.addRule('→', '→') 6console.log(encoder.encode('<a href="#">→</a>')) // outputs '<a href="#">→</a>'
Adds rules or updates the existing rules for entity encoding.
Passed object is a simple key-value object, i.e. { '<': '<', '>': '>' }
Returns true if the rules were added successfully or false if not.
1const Encoder = require('encode-entities') 2 3const encoder = new Encoder() 4 5encoder.addRules({ 6 '𝕋': '𝕋', 7 '≈': '≈', 8 '𝔱': '𝔱', 9}) 10 11console.log(encoder.encode('<span>𝕋 ≈ 𝔱</span>')) // outputs '<span>𝕋 ≈ 𝔱</span>'
Removes the rule that matches the provided key. Returns true if the rule was removed successfully or false if not.
1const Encoder = require('encode-entities') 2 3const encoder = new Encoder() 4 5encoder.addRules({ 6 '𝕋': '𝕋', 7 '≈': '≈', 8 '𝔱': '𝔱', 9}) 10encoder.removeRule('≈') 11 12console.log(encoder.rulesCount()) // outputs 20
Gets the number of rules for entity encoding.
1const Encoder = require('encode-entities') 2 3const encoder = new Encoder() 4 5encoder.addRules({ 6 '𝕋': '𝕋', 7 '≈': '≈', 8 '𝔱': '𝔱', 9}) 10 11console.log(encoder.rulesCount()) // outputs 21
Encodes special characters in the given string to HTML entities.
1const Encoder = require('encode-entities') 2 3const encoder = new Encoder() 4 5console.log(encoder.encode('<strong>')) // outputs '<strong>'
1npm test
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 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
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
13 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
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