workplus-escape
v1.0.2
Published
Escape or unescape string for use in HTML.
Downloads
4
Readme
workplus-escape
Toggle escape string and object for use in HTML.
Install
npm install --save workplus-escape
Usage
import {
escapeString,
unescapeString,
escapeObject,
unescapeObject
} from 'workplus-query-string';
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/workplus-escape.git
npm install
npm test
License
MIT