Releases: JiangJie/happy-codec
Releases · JiangJie/happy-codec
v1.2.0
[1.2.0] - 2026-02-12
Added
SharedArrayBuffersupport (zero-copy) for all encoding functionsAllowSharedBufferSourceinput type across the public API (DataSource,decodeUtf8,bufferSourceToBytes)
Changed
DataSourcetype widened fromstring | BufferSourcetostring | AllowSharedBufferSourcebufferSourceToBytesreturn type simplified fromUint8Array<ArrayBuffer>toUint8Array
Full Changelog: v1.1.0...v1.2.0
v1.1.0
[1.1.0] - 2026-02-09
Added
EncodeBase64Optionsinterface (alphabet,omitPadding) forencodeBase64()DecodeBase64Optionsinterface (alphabet,lastChunkHandling) fordecodeBase64()- Input validation for
decodeByteStringanddecodeHex - Native
Uint8Array.fromBase64/Uint8Array.prototype.toBase64andUint8Array.fromHex/Uint8Array.prototype.toHex(ES2026) detection with pure JS fallback
Fixed
decodeBase64Fallbackbyte length calculation and validation
Changed
- Always prefer native APIs when available, removed all fallback thresholds
- Switched
encodeByteStringto chunkedString.fromCharCode.applyfor large inputs - Replaced runtime hex parsing with pre-computed lookup tables
- UTF-8 encode fallback: replaced dynamic array with pre-allocated
Uint8Array - UTF-8 decode fallback: switched from code-point array to pre-allocated
Uint16Array - UTF-8 decode: skip BOM at byte level instead of post-decode string strip
- Extracted shared
typedArrayToStringhelper andAPPLY_CHUNKconstant into internal module - Standardized input validation and error types across all decode functions
- Improved
dataSourceToBytestype guard and cleaned up internals
Full Changelog: v1.0.0...v1.1.0
v1.0.0
[1.0.0] - 2026-02-06
Added
- Universal runtime support (Browser, Node.js, Deno, Bun, 小程序/小游戏, etc.)
- Base64 encoding/decoding with fast pure-JS encoder and native decoder fallback
- Hex encoding/decoding
- UTF-8 encoding/decoding with
TextEncoder/TextDecoderfallbackfataloption to throw on invalid byte sequencesignoreBOMoption to control BOM handling
- ByteString encoding/decoding
- 100% test coverage
Full Changelog: https://github.com/JiangJie/happy-codec/commits/v1.0.0