@w6s/escape
v1.0.2
Published
Escape or unescape string for use in HTML.
Downloads
9
Readme
@w6s/escape
Toggle escape string and object for use in HTML.
Install
npm install --save @w6s/escape
Usage
import {
escapeString,
unescapeString,
escapeObject,
unescapeObject
} from '@w6s/escape';
const str = escapeString('<h1></h1>"');
// str => '<h1></h1>"'
const rts = unescapeString('<h2></h2>');
// rts => '<h2></h2>'
let someObject = {
a: '<h1></h1>',
b: "'",
c: {
x: '""'
}
};
let obj = escapeObject(someObject);
// obj.a => '<h1></h1>'
// ibj.b => '''
// obj.c.x => '""'
let jbo = unescapeObject(obj);
// jbo.a => '<h1></h1>'
Development
git clone https://github.com/WorkPlusFE/escape.git
npm install
npm test
License
MIT