html-entities-not-email-friendly examples

Table of Contents

Quick Take

import { strict as assert } from "assert";
import {
  notEmailFriendly,
  notEmailFriendlySetOnly,
  notEmailFriendlyLowercaseSetOnly,
  notEmailFriendlyMinLength,
  notEmailFriendlyMaxLength,
} from "html-entities-not-email-friendly";

// it's object, mapping entity names to numeric equivalents
assert.equal(
  Object.keys(notEmailFriendly).length,
  1841
);

// it's a Set, only listing the bad entity names
assert.equal(notEmailFriendlySetOnly.size, 1841);

// is ≳ email-friendly?
assert.equal(
  notEmailFriendlySetOnly.has("GreaterTilde"),
  true
);
// no, use numeric entity

// is   email-friendly?
assert.equal(
  notEmailFriendlySetOnly.has("nbsp"),
  false
);
// yes, it's OK