npm.io
7.1.3 • Published 5 months ago

string-fix-broken-named-entities

Licence
MIT
Version
7.1.3
Deps
5
Size
181 kB
Vulns
0
Weekly
0
Stars
212

string-fix-broken-named-entities

Finds and fixes common and not so common broken named HTML entities, returns ranges array of fixes

page on codsen.com page on npm page on github Downloads per month changelog MIT Licence

Install

This package is pure ESM. If you're not ready yet, install an older version of this program, 5.4.0 (npm i string-fix-broken-named-entities@5.4.0).

npm i string-fix-broken-named-entities

Quick Take

import { strict as assert } from "assert";
import { rApply } from "ranges-apply";

import { fixEnt } from "string-fix-broken-named-entities";

const source = "&nsp;x&nsp;y&nsp;";

// returns Ranges notation, see codsen.com/ranges/
assert.deepEqual(fixEnt(source), [
  [0, 5, " "],
  [6, 11, " "],
  [12, 17, " "],
]);

// render result from ranges using "ranges-apply":
assert.equal(rApply(source, fixEnt(source)), " x y ");

Documentation

Please visit codsen.com for a full description of the API. If you’re looking for the Changelog, it’s here.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License

Copyright 2010-2026 Roy Revelt and other contributors

ok codsen star

Keywords