Escaper
A small library which provides methods to escape
and unescape
HTML entities before inserting untrusted data into HTML element content. (XSS prevention)
Usage
var hescape = require('es-en');
var escape = hescape.escape;
var unescape = hescape.unescape;
var html = '<h1>Help me!</h1>';
var escaped = escape(html);
var unescaped = unescape(escaped);
console.log('html', html, 'escaped', escaped, 'unescaped', unescaped);
Output - " html <h1>Help me!</h1> escaped <h1>Help me!</h1> unescaped <h1>Help me!</h1> "
Tests
npm test
Contributing
Add unit tests for any new or changed functionality.
Release History
- 0.1.0 Initial release