html-escaper
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -39,2 +39,8 @@ 'use strict'; | ||
/** | ||
* Safely escape HTML entities such as `&`, `<`, `>`, `"`, and `'`. | ||
* @param {string|number|boolean} es the input to safely escape | ||
* @returns {string} the escaped input, and it throws an error if | ||
* the input type is unexpected | ||
*/ | ||
const escape = es => replace.call(es, ca, pe); | ||
@@ -59,3 +65,10 @@ exports.escape = escape; | ||
/** | ||
* Safely unescape previously escaped entities such as `&`, `<`, `>`, `"`, | ||
* and `'`. | ||
* @param {string} un a previously escaped string | ||
* @returns {string} the unescaped input, and it throws an error if | ||
* the input type is unexpected | ||
*/ | ||
const unescape = un => replace.call(un, es, cape); | ||
exports.unescape = unescape; |
@@ -38,2 +38,8 @@ /** | ||
/** | ||
* Safely escape HTML entities such as `&`, `<`, `>`, `"`, and `'`. | ||
* @param {string|number|boolean} es the input to safely escape | ||
* @returns {string} the escaped input, and it throws an error if | ||
* the input type is unexpected | ||
*/ | ||
export const escape = es => replace.call(es, ca, pe); | ||
@@ -57,2 +63,9 @@ | ||
/** | ||
* Safely unescape previously escaped entities such as `&`, `<`, `>`, `"`, | ||
* and `'`. | ||
* @param {string} un a previously escaped string | ||
* @returns {string} the unescaped input, and it throws an error if | ||
* the input type is unexpected | ||
*/ | ||
export const unescape = un => replace.call(un, es, cape); |
13
index.js
@@ -41,2 +41,8 @@ var html = (function (exports) { | ||
/** | ||
* Safely escape HTML entities such as `&`, `<`, `>`, `"`, and `'`. | ||
* @param {string|number|boolean} es the input to safely escape | ||
* @returns {string} the escaped input, and it throws an error if | ||
* the input type is unexpected | ||
*/ | ||
const escape = es => replace.call(es, ca, pe); | ||
@@ -60,2 +66,9 @@ | ||
/** | ||
* Safely unescape previously escaped entities such as `&`, `<`, `>`, `"`, | ||
* and `'`. | ||
* @param {string} un a previously escaped string | ||
* @returns {string} the unescaped input, and it throws an error if | ||
* the input type is unexpected | ||
*/ | ||
const unescape = un => replace.call(un, es, cape); | ||
@@ -62,0 +75,0 @@ |
{ | ||
"name": "html-escaper", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "fast and safe way to escape and unescape &<>'\" chars", | ||
@@ -10,7 +10,7 @@ "main": "./cjs/index.js", | ||
"cjs": "ascjs esm cjs", | ||
"coveralls": "cat ./coverage/lcov.info | coveralls", | ||
"coveralls": "c8 report --reporter=text-lcov | coveralls", | ||
"minify": "uglifyjs index.js --comments=/^!/ --compress --mangle -o min.js", | ||
"rollup": "rollup --config rollup.config.js", | ||
"size": "cat index.js | wc -c;cat min.js | wc -c;gzip -c min.js | wc -c", | ||
"test": "istanbul cover ./test/index.js" | ||
"test": "c8 node ./test/index.js" | ||
}, | ||
@@ -42,8 +42,8 @@ "module": "./esm/index.js", | ||
"devDependencies": { | ||
"ascjs": "^3.1.2", | ||
"coveralls": "^3.0.11", | ||
"istanbul": "^0.4.5", | ||
"rollup": "^2.2.0", | ||
"ascjs": "^5.0.1", | ||
"c8": "^7.6.0", | ||
"coveralls": "^3.1.0", | ||
"rollup": "^2.39.0", | ||
"uglify-es": "^3.3.9" | ||
} | ||
} |
@@ -1,2 +0,5 @@ | ||
# html-escaper [![Build Status](https://travis-ci.org/WebReflection/html-escaper.svg?branch=master)](https://travis-ci.org/WebReflection/html-escaper) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/html-escaper/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/html-escaper?branch=master) | ||
# html-escaper | ||
![Downloads](https://img.shields.io/npm/dm/html-escaper.svg) [![Build Status](https://travis-ci.org/WebReflection/html-escaper.svg?branch=master)](https://travis-ci.org/WebReflection/html-escaper) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/html-escaper/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/html-escaper?branch=master) ![WebReflection status](https://offline.report/status/webreflection.svg) | ||
A simple module to escape/unescape common problematic entities. | ||
@@ -3,0 +6,0 @@ |
14910
213
106