A lightweight, dependency-free polyfill that provides reliable TextEncoder/TextDecoder-like encode and decode functions for a small set of encodings, including UTF-8, UTF-16LE, ASCII, Latin-1, and Windows-1252. Useful for JavaScript environments where native text encoding support is limited or inconsistent, such as some React Native Hermes setups or Node.js builds with restricted ICU support.
Project status
- The source is actively maintained: its latest update and upstream push were on 2026-10-28.
- Updates have been intermittent, with gaps of roughly three to four months between the recent changes.
AI summary generated
Recent updates
v0.2.3
v0.2.3 fixes UTF-8 fallback decoding to better match native TextDecoder behavior, consumes an initial UTF-16LE BOM, and falls back when native UTF-8 constructors throw. The code diff shows no public API signature or export changes, but it also includes unannounced updates to development dependencies and CI, Dependabot, and release automation.
v0.2.2
v0.2.2 is primarily a bug fix release focused on encoding correctness, with README documentation adjustments. The implementation change is largely contained in the core codec logic (lib/index.ts), plus expanded automated tests to cover malformed input and surrogate edge cases.
v0.2.1
v0.2.1 adds support for the "us-ascii" encoding and includes an optimization to avoid using String.fromCharCode spread when decoding ASCII. The implementation includes additional internal refactors around decoding performance (chunking, cached TextDecoder/TextEncoder instances) that go beyond what the release notes mention.
Featuresv0.2.0
Release v0.2.0 is documented as adding polyfill classes for TextDecoder and TextEncoder, and the README is updated with a broader encoding support table. However, the provided code diff shows no functional implementation changes related to TextDecoder/TextEncoder, and changes appear limited to documentation and package metadata/script adjustments.
Featuresv0.1.1
Release v0.1.1 primarily claims documentation improvements. The provided diff, however, shows multiple repo-level changes (CI workflow rename, adding Bun-based testing) and updates to README API documentation, including a potential change in the stated default parameter for encoding.
v0.1.0
This release is an initial NPM publication for @borewit/text-codec version 0.1.0. No release notes or changelog details are provided beyond the package version itself.