Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

string-fix-broken-named-entities

4.0.0 • Public • Published

string-fix-broken-named-entities

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

Install

npm i string-fix-broken-named-entities

Quick Take

import { strict as assert } from "assert";
import fixEnt from "string-fix-broken-named-entities";
import applyR from "ranges-apply";
 
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(applyR(source, fixEnt(source)), " x y ");

Documentation

Please visit codsen.com for a full description of the API and examples.

Licence

MIT License

Copyright (c) 2010-2020 Roy Revelt and other contributors

ok codsen star

Install

npm i string-fix-broken-named-entities

DownloadsWeekly Downloads

249

Version

4.0.0

License

MIT

Unpacked Size

577 kB

Total Files

10

Last publish

Collaborators

  • avatar