{"_id":"@bybrave/he2","_rev":"2-213e3d610fff441ef75a9cba33c8bbec","name":"@bybrave/he2","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.0":{"name":"@bybrave/he2","version":"2.0.0","keywords":["html","entities","entity","encode","decode","unicode","esm","typescript"],"author":{"name":"bybrave"},"license":"MIT","_id":"@bybrave/he2@2.0.0","maintainers":[{"name":"bybrave","email":"opmybrave@gmail.com"}],"homepage":"https://github.com/bybraveHQ/he2#readme","bugs":{"url":"https://github.com/bybraveHQ/he2/issues"},"bin":{"he":"bin/he.js"},"dist":{"shasum":"5f183cebdc2c486d448e0928686d08906fd2c887","tarball":"https://registry.npmjs.org/@bybrave/he2/-/he2-2.0.0.tgz","fileCount":8,"integrity":"sha512-nDUg2uIrkyA/+5BiHZOVd2pZ4tf+YNzQ44g303VLyBAhqPbC9JqSXVMl/fatlargFnocwWdnsFIU0UGwn/an4w==","signatures":[{"sig":"MEUCIQCBfdOU794L5/r+bjGYKt2BG7t4uZR0KcquLM9OF+ShmgIgO2PIFjzsAa9ECqZteYXI5yh4vk7Xs6M1oarkRRqnA5s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":214130},"main":"./dist/index.cjs","type":"module","types":"./index.d.ts","module":"./index.js","engines":{"node":">=18"},"exports":{".":{"types":"./index.d.ts","import":"./index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"gitHead":"ebcdd1bf1cfbfd7279121fcb2ffb5083ab88b94c","scripts":{"test":"node --test","build":"node build/build.js","test-types":"tsc --strict --noEmit --moduleResolution bundler --target es2020 --types node test/types.ts","prepublishOnly":"npm run build && npm test && npm run test-types"},"_npmUser":{"name":"bybrave","email":"opmybrave@gmail.com"},"repository":{"url":"git+https://github.com/bybraveHQ/he2.git","type":"git"},"_npmVersion":"10.8.2","description":"Maintained he fork: robust HTML entity encoder/decoder with full Unicode support, now as ESM + CommonJS with built-in TypeScript types and zero dependencies. Drop-in for he.","directories":{},"sideEffects":false,"_nodeVersion":"20.19.6","_hasShrinkwrap":false,"devDependencies":{"esbuild":"^0.24.0","typescript":"^5.6.0","@types/node":"^22.0.0"},"_npmOperationalInternal":{"tmp":"tmp/he2_2.0.0_1783267628905_0.26432637535902614","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@bybrave/he2","version":"2.0.1","description":"Maintained he fork: robust HTML entity encoder/decoder with full Unicode support, now as ESM + CommonJS with built-in TypeScript types and zero dependencies. Drop-in for he.","type":"module","main":"./dist/index.cjs","module":"./index.js","types":"./index.d.ts","bin":{"he":"bin/he.js"},"exports":{".":{"types":"./index.d.ts","import":"./index.js","require":"./dist/index.cjs"},"./package.json":"./package.json"},"sideEffects":false,"scripts":{"build":"node build/build.js","test":"node --test","test-types":"tsc --strict --noEmit --moduleResolution bundler --target es2020 --types node test/types.ts","prepublishOnly":"npm run build && npm test && npm run test-types"},"keywords":["html","entities","entity","encode","decode","unicode","esm","typescript"],"author":{"name":"bybrave"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/bybraveHQ/he2.git"},"bugs":{"url":"https://github.com/bybraveHQ/he2/issues"},"homepage":"https://github.com/bybraveHQ/he2#readme","engines":{"node":">=18"},"devDependencies":{"esbuild":"^0.24.0","typescript":"^5.6.0","@types/node":"^22.0.0"},"_id":"@bybrave/he2@2.0.1","gitHead":"e87278d29b042c5519a9a1d3a73e50015f4d307a","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-Fvnv+QJ8/JWOoX6B+G061tl0PZKeF4Aj0APm/fLEhzqUfGoH8CRL0OV5Pgy9NiTRh1c56DFQuYhFibpUc1iAbQ==","shasum":"e95307df3323c9f53ef92810eb290a6d186e1296","tarball":"https://registry.npmjs.org/@bybrave/he2/-/he2-2.0.1.tgz","fileCount":8,"unpackedSize":214497,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC1Bg5SX5gW5h4T74/bKmkHWQIa9HIAUzyIWxdYmvWgUwIhAM9dj9uTsD8H/sZ/te6DmHi3IWysqUwoP0ppnYdIneFF"}]},"_npmUser":{"name":"bybrave","email":"opmybrave@gmail.com"},"directories":{},"maintainers":[{"name":"bybrave","email":"opmybrave@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/he2_2.0.1_1783297175185_0.4732821547575248"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-05T16:07:08.694Z","modified":"2026-07-06T00:19:35.441Z","2.0.0":"2026-07-05T16:07:09.058Z","2.0.1":"2026-07-06T00:19:35.325Z"},"bugs":{"url":"https://github.com/bybraveHQ/he2/issues"},"author":{"name":"bybrave"},"license":"MIT","homepage":"https://github.com/bybraveHQ/he2#readme","keywords":["html","entities","entity","encode","decode","unicode","esm","typescript"],"repository":{"type":"git","url":"git+https://github.com/bybraveHQ/he2.git"},"description":"Maintained he fork: robust HTML entity encoder/decoder with full Unicode support, now as ESM + CommonJS with built-in TypeScript types and zero dependencies. Drop-in for he.","maintainers":[{"name":"bybrave","email":"opmybrave@gmail.com"}],"readme":"# @bybrave/he2\n\nMaintained fork of [`he`](https://www.npmjs.com/package/he) — a robust HTML entity encoder/decoder with full Unicode support.\n\nSame battle-tested, HTML-spec-compliant engine, now shipped as native **ESM + CommonJS** with **built-in TypeScript types**, **zero dependencies**, and the `he` CLI. Encode/decode output is **byte-for-byte identical** to `he@1.2.0`.\n\n## Install\n\n```sh\nnpm install @bybrave/he2\n```\n\n## Usage\n\n```js\nimport he from '@bybrave/he2';\n// or: import { encode, decode, escape, unescape } from '@bybrave/he2';\n\nhe.encode('foo © bar ≠ baz 𝌆 qux', { useNamedReferences: true });\n// → 'foo &copy; bar &ne; baz &#x1D306; qux'\n\nhe.decode('foo &copy; bar &ne; baz &#x1D306; qux');\n// → 'foo © bar ≠ baz 𝌆 qux'\n\nhe.escape('<img src=\"x\">');\n// → '&lt;img src=&quot;x&quot;&gt;'\n```\n\nCommonJS works too — `require` returns the same `{ encode, decode, escape, unescape, version }` object as the original:\n\n```js\nconst he = require('@bybrave/he2');\n```\n\n### API\n\n- `encode(text, options?)` — options: `useNamedReferences`, `decimal`, `encodeEverything`, `strict`, `allowUnsafeSymbols`.\n- `decode(html, options?)` — options: `isAttributeValue`, `strict`.\n- `escape(text)` — escapes only `&<>\"'` and backtick.\n- `unescape(html, options?)` — alias of `decode`.\n- `version` — the underlying he version.\n\n### CLI\n\n```sh\nhe --escape '<img src=\"x\">'\necho '&copy; &#x1D306;' | he --decode\n```\n\n## What's changed vs `he@1.2.0`\n\n| Change | Detail |\n|---|---|\n| ESM + CommonJS | Ships native ESM with a CommonJS build via the `exports` map — `import` and `require` both work. The original was UMD only. |\n| Built-in types | TypeScript types are bundled — no separate `@types/he` needed. |\n| Zero dependencies | Same as the original (no runtime deps), now maintained. |\n| Engine unchanged | The HTML-spec engine and generated Unicode tables are ported byte-for-byte; encode/decode/escape output matches `he@1.2.0` exactly. |\n\n## Migration from `he`\n\nDrop-in — replace the import:\n\n```diff\n- const he = require('he');\n+ const he = require('@bybrave/he2');\n```\n\nAll output is identical to `he@1.2.0`. Unlike `entities` or `html-entities`, this keeps the exact `he` API (`encode`/`decode`/`escape`/`unescape` with the same options), so no code changes are needed.\n\n## Support\n\nIf this package saves you time, you can support maintenance:\n\n[![Ko-fi](https://img.shields.io/badge/Ko--fi-buy%20me%20a%20coffee-FF5E5B?logo=kofi&logoColor=white)](https://ko-fi.com/bybrave)\n[![Bitcoin](https://img.shields.io/badge/Bitcoin-BTC-F7931A?logo=bitcoin&logoColor=white)](#support)\n\nBitcoin (BTC): `bc1q37557q5jpeaxqydzwvf3jgj7zhnfpn2td3q40q`\n\n## License\n\nMIT. Copyright © Mathias Bynens; fork © bybrave.\n","readmeFilename":"README.md"}