{"id":28734796,"url":"https://github.com/lechidung/escape","last_synced_at":"2025-10-25T16:38:40.919Z","repository":{"id":44661056,"uuid":"314311316","full_name":"lechidung/escape","owner":"lechidung","description":"Simple library escape or un escape HTML, String, SQL for Deno 🈵 🈵 🈵 💎 🔰","archived":false,"fork":false,"pushed_at":"2022-02-01T15:26:27.000Z","size":1758,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-16T00:13:32.066Z","etag":null,"topics":["deno","deno-escape","deno-unescape","escape","escape-html","html","html-escape"],"latest_commit_sha":null,"homepage":"https://deno.land/x/escape@1.4.2","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/lechidung.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-19T16:49:41.000Z","updated_at":"2024-05-24T21:46:50.000Z","dependencies_parsed_at":"2022-09-04T18:53:13.017Z","dependency_job_id":null,"html_url":"https://github.com/lechidung/escape","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/lechidung/escape","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lechidung%2Fescape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lechidung%2Fescape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lechidung%2Fescape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lechidung%2Fescape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lechidung","download_url":"https://codeload.github.com/lechidung/escape/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lechidung%2Fescape/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265846538,"owners_count":23838095,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["deno","deno-escape","deno-unescape","escape","escape-html","html","html-escape"],"created_at":"2025-06-16T00:01:06.570Z","updated_at":"2025-10-25T16:38:35.888Z","avatar_url":"https://github.com/lechidung.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Escape\nSimple library for escape or unescape HTML, String, SQL,... for Deno framework.\n\n![Deno JS](https://img.shields.io/badge/deno%20js-000000?style=for-the-badge\u0026logo=deno\u0026logoColor=white)\n![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge\u0026logo=typescript\u0026logoColor=white)\n\n![build and test workflow](https://github.com/lechidung/escape/actions/workflows/github-actions.yml/badge.svg)\n![Languages](https://img.shields.io/github/languages/top/lechidung/escape)\n![Version](https://img.shields.io/github/v/release/lechidung/escape)\n![Release date](https://img.shields.io/github/release-date/lechidung/escape)\n![Issues](https://img.shields.io/github/issues/lechidung/escape)\n\n## API\n\n### Escape HTML\n```js\nimport { escapeHtml } from \"https://deno.land/x/escape/mod.ts\";\n```\n\n#### **1. escapeHtml(string: string): string**\n\nEscape special characters in the given string of text, such that it can be\ninterpolated in HTML content.\n\nThis function will escape the following characters: `\"`, `'`, `\u0026`, `\u003c`, and\n`\u003e`.\n\n**Note** that the escaped value is only suitable for being interpolated into\nHTML as the text content of elements in which the tag does not have different\nescaping mechanisms (it cannot be placed inside `\u003cstyle\u003e` or `\u003cscript\u003e`, for\nexample, as those content bodies are not HTML, but CSS and JavaScript,\nrespectively; these are known as \"raw text elements\" in the HTML standard).\n\n#### Example\n\nThe `escapeHtml` function is designed to accept a string input of text and\nreturn an escaped value to interpolate into HTML.\n\n```js\nimport { escapeHtml } from \"https://deno.land/x/escape/mod.ts\";\n\nconsole.log(escapeHtml(\"\u003cscript\u003esample\u003c/script\u003e\"));\n// Result: '\u0026lt;script\u0026gt;sample\u0026lt;/script\u0026gt;'\n\n```\n#### **2. isEscape(string: string): boolean**\n\nThis function will check exist escape the following characters: `\"`, `'`, `\u0026`, `\u003c`, and\n`\u003e`.\n\n#### Example\n\n```js\nimport { isEscape } from \"https://deno.land/x/escape/mod.ts\";\n\nconsole.log(isEscape(\"\u003cscript\u003esample\u003c/script\u003e\"));\n// Result: true\n\n```\n\n### Un Escape HTML\n```js\nimport { unescapeHtml } from \"https://deno.land/x/escape/mod.ts\";\n```\n\n#### **1. unescapeHtml(string: string): string**\n\nConvert HTML entities to HTML characters, e.g. \u0026gt; converts to \u003e.\n\n#### Example\n\nThe `unescapeHtml` function is designed to accept a string input of text and\nreturn an un-escaped value to interpolate into HTML.\n\n```js\nimport { unescapeHtml } from \"https://deno.land/x/escape/mod.ts\";\n\nconsole.log(unescapeHtml(\"\u0026amp;lt;script\u0026amp;gt;sample\u0026amp;lt;/script\u0026amp;gt;\"));\n// Result: '\u003cscript\u003esample\u003c/script\u003e'\n\n```\n\n#### **2. isUnescape(string: string): boolean**\n\nThis function will check exist unescape the following characters: `\u0026amp;`, `\u0026gt;`, `\u0026lt;`, `\u0026#x3A;`, `\u0026quot;` and\n`\u0026#39;`.\n\n#### Example\n\n```js\nimport { isUnescape } from \"https://deno.land/x/escape/mod.ts\";\n\nconsole.log(isUnescape(\"\u0026amp;lt;script\u0026amp;gt;sample\u0026amp;lt;/script\u0026amp;gt;\"));\n// Result: true\n\n```\n\n### Escape SQL\n```js\nimport { escapeSql } from \"https://deno.land/x/escape/mod.ts\";\n```\n\n#### **1. escapeSql(SqlString: string): string**\n\nEscape SQL special characters and quotes in strings.\n\n#### Example\n\nThe `unescapeHtml` function is designed to accept a sql string and\nreturn an escaped sql string.\n\n```js\nimport { escapeSql } from \"https://deno.land/x/escape/mod.ts\";\n\nconsole.log(escapeSql(\"insert into table_exp values('hi, my name''s johnny.');\"));\n// Result: 'insert into my_table values(\\'hi, my name\\'\\'s johnny.\\');'\n\n```\n# License\n[![MIT](https://img.shields.io/github/license/Ileriayo/markdown-badges?style=for-the-badge)](./LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flechidung%2Fescape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flechidung%2Fescape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flechidung%2Fescape/lists"}