es-en

0.1.6 • Public • Published

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 &lt;h1&gt;Help me!&lt;&#x2F;h1&gt; 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

Readme

Keywords

Package Sidebar

Install

npm i es-en

Weekly Downloads

1

Version

0.1.6

License

MIT

Last publish

Collaborators

  • nitin42