{"id":18396722,"url":"https://github.com/igorskyflyer/npm-encode-entities","last_synced_at":"2026-02-26T23:03:29.307Z","repository":{"id":56184780,"uuid":"212586380","full_name":"igorskyflyer/npm-encode-entities","owner":"igorskyflyer","description":" 🏃‍♂️ Fast and simple Map and RegExp based HTML entities encoder.🍁","archived":false,"fork":false,"pushed_at":"2025-08-28T18:56:03.000Z","size":248,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-02T01:53:30.060Z","etag":null,"topics":["back-end","biome","characters","decoder","encode-entities","encoder","fast","html","html-entities","igorskyflyer","javascript","map","module","node","npm","package","regexp","typescript","vitest"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@igorskyflyer/encode-entities","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igorskyflyer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"ko_fi":"igorskyflyer"}},"created_at":"2019-10-03T13:24:37.000Z","updated_at":"2025-08-28T18:55:37.000Z","dependencies_parsed_at":"2025-08-28T18:30:38.720Z","dependency_job_id":"c728e403-b048-46b5-88cd-db8bca7abb7f","html_url":"https://github.com/igorskyflyer/npm-encode-entities","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/igorskyflyer/npm-encode-entities","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorskyflyer%2Fnpm-encode-entities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorskyflyer%2Fnpm-encode-entities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorskyflyer%2Fnpm-encode-entities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorskyflyer%2Fnpm-encode-entities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igorskyflyer","download_url":"https://codeload.github.com/igorskyflyer/npm-encode-entities/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorskyflyer%2Fnpm-encode-entities/sbom","scorecard":{"id":482797,"data":{"date":"2025-08-11","repo":{"name":"github.com/igorskyflyer/npm-encode-entities","commit":"902d49dee58038a8fa27aa57b487f0c743946183"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"13 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3","Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx","Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6","Warn: Project is vulnerable to: GHSA-x574-m823-4x7w","Warn: Project is vulnerable to: GHSA-4r4m-qw57-chr8","Warn: Project is vulnerable to: GHSA-xcj6-pq6g-qj4x","Warn: Project is vulnerable to: GHSA-356w-63v5-8wf4","Warn: Project is vulnerable to: GHSA-859w-5945-r5v3","Warn: Project is vulnerable to: GHSA-9crc-q9x8-hgqq"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T17:02:33.750Z","repository_id":56184780,"created_at":"2025-08-19T17:02:33.750Z","updated_at":"2025-08-19T17:02:33.750Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29876357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T22:37:10.609Z","status":"ssl_error","status_checked_at":"2026-02-26T22:37:09.019Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["back-end","biome","characters","decoder","encode-entities","encoder","fast","html","html-entities","igorskyflyer","javascript","map","module","node","npm","package","regexp","typescript","vitest"],"created_at":"2024-11-06T02:14:39.236Z","updated_at":"2026-02-26T23:03:29.300Z","avatar_url":"https://github.com/igorskyflyer.png","language":"TypeScript","funding_links":["https://ko-fi.com/igorskyflyer"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/igorskyflyer/npm-encode-entities/main/media/encode-entities.png\" alt=\"Icon of Encode Entities\" width=\"256\" height=\"256\"\u003e\n  \u003ch1\u003eEncode Entities\u003c/h1\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n\u003ch4 align=\"center\"\u003e\n  🏃‍♂️ Fast and simple Map and RegExp based HTML entities encoder. 🍁\n\u003c/h4\u003e\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## 📃 Table of Contents\n\n- [Features](#-features)\n- [Usage](#-usage)\n- [API](#-api)\n- [Changelog](#-changelog)\n- [Support](#-support)\n- [License](#-license)\n- [Related](#-related)\n- [Author](#-author)\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## 🤖 Features\n\n- ⚡ Instant HTML encoding for special characters\n- 🛠 Add your own custom encoding rules\n- ♻ Reset back to default rules anytime\n- ✏️ Update individual rules on the fly\n- ❌ Remove unwanted rules easily\n- 📊 See exactly how many rules are active\n- 🚀 Single‑pass, high‑performance replacement engine (powered by [`@igorskyflyer/mapped-replacer`](https://www.npmjs.com/package/@igorskyflyer/mapped-replacer))\n\n\u003cbr\u003e\n\n\u003e 🛡 **SECURITY**\n\u003e\n\u003e Encoding of special characters into HTML entities helps mitigate XSS risks in the textual layer by ensuring user‑supplied content is treated as text, not executable code.\n\u003e\n\u003e **Note: not a full XSS solution, usage of other XSS-prevention techniques is still required.**\n\u003e\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## 🕵🏼 Usage\n\nInstall it by executing any of the following, depending on your preferred package manager:\n\n```bash\npnpm add @igorskyflyer/encode-entities\n```\n\n```bash\nyarn add @igorskyflyer/encode-entities\n```\n\n```bash\nnpm i @igorskyflyer/encode-entities\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## 🤹🏼 API\n\n\u003e 💡 **TIP**\n\u003e\n\u003e *Encoded by default:*\n\u003e **\u003c**, **\u003e**, **\"**, **'**, **\u0026**, **=**, `**,** **!**, **@**, **\\$**, **%**, **(**, **)**, **+**, **{**, **}**, **[**, **]**.\n\u003e\n\u003e You can however remove any of these rules and/or add your own.\n\u003e\n\n\u003cbr\u003e\n\n\n### resetRules(): void\n\n_Resets the rules to the default ones._\n\n```ts\nimport { Encoder } from '@igorskyflyer/encode-entities'\n\nconst encoder: Encoder = new Encoder()\n\nencoder.updateRule('😀', '\u003c')\nencoder.updateRule('😂', '\u003e')\nencoder.resetRules()\n\nconsole.log(encoder.encode('\u003cstrong\u003e')) // outputs '\u0026#60;strong\u0026#62;'\n```\n\n\u003cbr\u003e\n\n### addRule(key: string, value: string): boolean\n\n_Adds a new rule for entities encoding. Returns true if the rule was added successfully or false if not._\n\n```ts\nimport { Encoder } from '@igorskyflyer/encode-entities'\n\nconst encoder: Encoder = new Encoder()\nencoder.addRule('\u0026#8594;', '→')\n\nconsole.log(encoder.encode('\u003ca href=\"#\"\u003e→\u003c/a\u003e')) // outputs '\u0026#60;a href\u0026#61;\u0026#34;#\u0026#34;\u0026#62;\u0026#8594;\u0026#60;/a\u0026#62;'\n```\n\n\u003cbr\u003e\n\n### updateRule(replaceWith: string, searchFor: string): boolean\n\n_Updates an existing rule for entity encoding. Returns true if the rule was updated successfully or false if not._\n\n```ts\nimport { Encoder } from '@igorskyflyer/encode-entities'\n\nconst encoder: Encoder = new Encoder()\nencoder.addRule('\u0026#8592;', '→')\nencoder.updateRule('\u0026#8594;', '→')\n\nconsole.log(encoder.encode('\u003ca href=\"#\"\u003e→\u003c/a\u003e')) // outputs '\u0026#60;a href\u0026#61;\u0026#34;#\u0026#34;\u0026#62;\u0026#8594;\u0026#60;/a\u0026#62;'\n```\n\n\u003cbr\u003e\n\n### addRules(rules: Object): boolean\n\n_Adds rules for entity encoding._\u003cbr\u003e\n_Passed object is a simple key-value object, i.e. **{ '\u003c': '\\\u0026#60;', '\u003e': '\\\u0026#62;' }**_\u003cbr\u003e\n_Returns true if the rules were added successfully or false if not._\n\n```ts\nimport { Encoder } from '@igorskyflyer/encode-entities'\n\nconst encoder: Encoder = new Encoder()\n\nencoder.addRules({\n  '\u0026#120139;':'𝕋'\n  '\u0026#8776;':'≈'\n  '\u0026#120113;':'𝔱'\n})\n\nconsole.log(encoder.encode('\u003cspan\u003e𝕋 ≈ 𝔱\u003c/span\u003e')) // outputs '\u0026#60;span\u0026#62;\u0026#120139; \u0026#8776; \u0026#120113;\u0026#60;/span\u0026#62;'\n```\n\n\u003cbr\u003e\n\n### removeRule(key: string): boolean\n\n_Removes the rule that matches the provided key._\n_Returns true if the rule was removed successfully or false if not._\n\n```ts\nimport { Encoder } from '@igorskyflyer/encode-entities'\n\nconst encoder: Encoder = new Encoder()\n\nencoder.addRules({\n  '\u0026#120139;': '𝕋',\n  '\u0026#8776;': '≈',\n  '\u0026#120113;': '𝔱'\n})\nencoder.removeRule('≈')\n\nconsole.log(encoder.rulesCount()) // outputs 20\n```\n\n\u003cbr\u003e\n\n### rulesCount(): number\n\n_Gets the number of rules for entity encoding._\n\n```ts\nimport { Encoder } from '@igorskyflyer/encode-entities'\n\nconst encoder: Encoder = new Encoder()\n\nencoder.addRules({\n  '\u0026#120139;': '𝕋',\n  '\u0026#8776;': '≈',\n  '\u0026#120113;': '𝔱',\n})\n\nconsole.log(encoder.rulesCount()) // outputs 21\n```\n\n\u003cbr\u003e\n\n### encode()\n\n_Encodes special characters in the given string to HTML entities._\n\n```ts\nimport { Encoder } from '@igorskyflyer/encode-entities'\n\nconst encoder: Encoder = new Encoder()\n\nconsole.log(encoder.encode('\u003cstrong\u003e')) // outputs '\u0026#60;strong\u0026#62;'\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## 📝 Changelog\n\n📑 The changelog is available here, [CHANGELOG.md](https://github.com/igorskyflyer/npm-encode-entities/blob/main/CHANGELOG.md).\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## 🪪 License\n\nLicensed under the MIT license which is available here, [MIT license](https://github.com/igorskyflyer/npm-encode-entities/blob/main/LICENSE).\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## 💖 Support\n\n\u003cdiv align=\"center\"\u003e\n  I work hard for every project, including this one and your support means a lot to me!\n  \u003cbr\u003e\n  Consider buying me a coffee. ☕\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://ko-fi.com/igorskyflyer\" target=\"_blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/igorskyflyer/igorskyflyer/main/assets/ko-fi.png\" alt=\"Donate to igorskyflyer\" width=\"180\" height=\"46\"\u003e\u003c/a\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003cem\u003eThank you for supporting my efforts!\u003c/em\u003e 🙏😊\n\u003c/div\u003e\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## 🧬 Related\n\n[@igorskyflyer/str-is-in](https://www.npmjs.com/package/@igorskyflyer/str-is-in)\n\n\u003e _🧵 Provides ways of checking whether a String is present in an Array of Strings using custom Comparators. 🔍_\n\n[@igorskyflyer/aria](https://www.npmjs.com/package/@igorskyflyer/aria)\n\n\u003e _🧬 Meet Aria, an efficient Adblock filter list compiler, with many features that make your maintenance of Adblock filter lists a breeze! 🗡_\n\n[@igorskyflyer/pathexists](https://www.npmjs.com/package/@igorskyflyer/pathexists)\n\n\u003e _🧲 Provides ways of properly checking if a path exists inside a given array of files/directories both on Windows and UNIX-like operating systems. 🗺_\n\n[@igorskyflyer/chars-in-string](https://www.npmjs.com/package/@igorskyflyer/chars-in-string)\n\n\u003e _🪐 Provides ways of testing whether an array of chars is present inside a given String. ☄_\n\n[@igorskyflyer/valid-path](https://www.npmjs.com/package/@igorskyflyer/valid-path)\n\n\u003e _🧰 Provides ways of testing whether a given value can be a valid file/directory name. 🏜_\n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n## 👨🏻‍💻 Author\nCreated by **Igor Dimitrijević** ([*@igorskyflyer*](https://github.com/igorskyflyer/)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figorskyflyer%2Fnpm-encode-entities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figorskyflyer%2Fnpm-encode-entities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figorskyflyer%2Fnpm-encode-entities/lists"}