Toggle escape string and object for use in HTML.
npm install --save @w6s/escape
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>'
git clone https://github.com/WorkPlusFE/escape.git
npm install
npm test
MIT