How to use html-entities

Comprehensive html-entities code examples:

How to use html-entities.encode:

2
3
4
5
6
7
8
9
10
11
12
const entities = require('html-entities')
const Autolinker = require('autolinker')


const out = (input) => {
  return Autolinker.link(
    entities.encode(input),
    {
      newWindow: false,
      urls: { schemeMatches: true, wwwMatches: false, tldMatches: false },
      phone: false,

How to use html-entities.decode:

1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
_unescapeHtmlEntities: function (str) {
  if (!str) {
    return str;
  }

  return htmlEntities.decode(str);
},

/**
 * Finds entity inside of the JSONLD graphs and returns value from the specified field