Ent

ent

Encode and decode HTML entities.

ent helps in encoding and ecoding HTML entities.

Get it: npm install ent

Sample usage:

1
2
3
const ent = require('ent');
console.log(ent.encode('<span>©moo</span>'))
console.log(ent.decode('&pi; &amp; &rho;'));
1
2
&#60;span&#62;&#169;moo&#60;/span&#62;
π & ρ
1
2
3
4
5
6
7
const ent = require('ent');

const encode = require('ent/encode');
// ^ Escape unsafe characters in str with html entities.

const decode = require('ent/decode');
// ^ Convert html entities in str back to raw text.

GIF FTW!

ent

Suggest a module

Comments