@nodable/entities

Entity parser for XML, HTML, External entites with security and NCR control

  • Types
  • ESM
License
MIT
Deps
0
Install Size
60 kB
Vulns
0
Published

Get started

$npm install @nodable/entities
$pnpm add @nodable/entities
$yarn add @nodable/entities
$bun add @nodable/entities
$deno add npm:@nodable/entities
$vlt install @nodable/entities
$vp add @nodable/entities

Weekly DownloadsAcross all versions

Versions

View all versions
2.1.1
latest

Readme

@nodable/entities

Fast, zero-dependency XML/HTML entity encoder and decoder for Node.js.

Install

npm install @nodable/entities

Quick start

import { EntityEncoder, EntityDecoder, ALL_ENTITIES } from '@nodable/entities';

// Encode: plain text → entity references
const enc = new EntityEncoder();
enc.encode('Hello © 2024 & <stuff>');
// → 'Hello &copy; 2024 &amp; &lt;stuff&gt;'

// Decode: entity references → plain text
const dec = new EntityDecoder({ namedEntities: ALL_ENTITIES });
dec.decode('Hello &copy; 2024 &amp; &lt;stuff&gt;');
// → 'Hello © 2024 & <stuff>'

Performance

encode decode
entities (npm) 3.65 M req/s 1.76 M req/s
@nodable/entities 3.33 M req/s 5.19 M req/s

Documentation

License

MIT