@nodable/entities
v2.1.1
Published
Entity parser for XML, HTML, External entites with security and NCR control
Maintainers
Readme
@nodable/entities
Fast, zero-dependency XML/HTML entity encoder and decoder for Node.js.
Install
npm install @nodable/entitiesQuick start
import { EntityEncoder, EntityDecoder, ALL_ENTITIES } from '@nodable/entities';
// Encode: plain text → entity references
const enc = new EntityEncoder();
enc.encode('Hello © 2024 & <stuff>');
// → 'Hello © 2024 & <stuff>'
// Decode: entity references → plain text
const dec = new EntityDecoder({ namedEntities: ALL_ENTITIES });
dec.decode('Hello © 2024 & <stuff>');
// → '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
- EntityEncoder — options, API, recipes
- EntityDecoder — options, API, security limits, entity sets
License
MIT
