Skip to content

bitanath/escape-entities

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Escape HTML entities like ♦ or ♦ to πŸ’Ž

Use in either nodejs or the browser. It's really simple and works pretty fast.

Installation

Browser 🌎 : https://cdn.jsdelivr.net/npm/entity-escape@latest/index.min.js

Node.js πŸ›  : npm install --save entity-escape

Usage

Browser:

var text1 = Entities.unescape('The big & and sparkly diamond ( almost ) glittered in the dark.');

var text2 = Entities.escape('This is a diamond ♦, watch it β—Š');

console.log(text1,text2);

Node.js:

const Entities = require('entity-escape');

var text1 = Entities.unescape('The big & and sparkly diamond ( almost ) glittered in the dark.');

var text2 = Entities.escape('This is a diamond ♦, watch it β—Š');

console.log(text1,text2);

Methods and Options

Entities.unescape(text,options); //options are {silent:false(default on node, true default on browser),replaceNumbers:true(true default on node, replaces numbered entities even if no names are present)}

Entities.escape(text,options); //options are {silent:false(default on node, true default on browser)}

In case {silent:true} no output is rendered to the console. In case replaceNumbers:false only those characters which are explicitly named HTML entities will be replaced.

Small bump up

There might actually now be way better packages to achieve this. I will be deleting this repository soon.

About

Escape HTML entities like ♦ or ♦ to πŸ’Ž

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published