node-escapist

0.1.1-f • Public • Published

node-escapist Build Status

The little npm module which is required to encode user input to put in database or html with tags to put it on page as is

Installation

npm install node-escapist --save

Or install dev version directly from GitHub:

npm install git://github.com/vpukhanov/node-escapist.git

Usage

var escapist = require('node-escapist');
var html = '<h1>Hello World</h1>';
var escaped = escapist.escape(html); // Fully escape
// var escaped = escapist.unicode.escape(html);
// var escaped = escapist.popular.escape(html);
// var escaped = escapist.math.escape(html);

console.log(escaped);

var unescaped = escapist.unescape(escaped);
// var unescaped = escapist.unicode.unescape(escaped);
// and so one...

console.log(unescaped);

About variants of escaping and unescaping you can read in the wiki

Tests

npm test

Contributing

If you want to add new feature, go on! Contribution is awesome! The only thing I ask you to do is covering new or changed functionality with tests. Also, please test your code before request.

Origin commits and pull requests are also checked by Travis CI

Package Sidebar

Install

npm i node-escapist

Weekly Downloads

4

Version

0.1.1-f

License

GPLv3

Last publish

Collaborators

  • vpukhanov