Skip to content

Releases: oe/NumBase

v1.1.1

Choose a tag to compare

@oe oe released this 03 Oct 18:13

NumBase 1.1.1 improves exact integer conversion performance while preserving the public API, validation rules, digit formats and no-BigInt compatibility.

  • Extract multiple digits per BigInt division and avoid temporary encode arrays.
  • Use native formatting through radix 36 with DIY symbol translation, and native parsing for long binary/octal/hexadecimal input after strict validation.
  • Keep short decoding cheap by separating native parsing and delaying BigInt radix allocation.
  • Highlight arbitrary radices and caller-defined digit symbols, with reproducible competitor comparisons and raw measurements.

Measured on Node 22/24 against 1.1.0: sampled Base62 encoding is approximately 2.2–2.7× faster for 64-/128-bit IDs and 4.8–5.4× for 1,000-digit decimal strings; long hexadecimal decoding is approximately 3.4–3.6× faster. These are workload-specific measurements, not a universal performance guarantee.

Validation: 36 Vitest tests, 100% statements/branches/functions/lines, consumer TypeScript and packed-installation checks, Node 22/24 CI, and verification of the published npm tarball against the main-branch artifacts. No new runtime dependencies.

npm: https://www.npmjs.com/package/numbase/v/1.1.1
Comparison: https://github.com/oe/NumBase/blob/master/benchmarks/competitors/README.md

v1.1.0

Choose a tag to compare

@oe oe released this 03 Oct 15:52
08d55a4

NumBase 1.1.0 simplifies conversion by fixing each instance's alphabet at construction. Alphabet validation, digit lookup construction, and native radix-formatting eligibility now run once, rather than during repeated conversions.

Configuration notice

BASE is now a frozen readonly array and MAX_BASE is its fixed length. Versions 0.x and 1.0.0 allowed these properties to be changed; assignments are no longer supported. Create a new instance to change alphabets, or pass a radix per operation. Read access remains available.

Valid encoded output, the default Base62 order (0–9, a–z, A–Z), Unicode options, precision validation, and the no-BigInt fallback remain unchanged. README examples now use modern imports.

Validation and performance

  • All 33 Vitest tests pass with 100% statements, branches, functions, and lines; Node 22/24 CI passes.
  • An additional 720 seeded values match published 1.0.0 across custom alphabets and radices.
  • TypeScript consumer checks and packed CommonJS/ESM installation pass.
  • Minified output shrinks from 4,961 to 4,162 bytes; gzip from 1,952 to 1,707 bytes. Zero runtime dependencies.
  • Local Node 24 benchmarks show about 2x faster 64-bit ID decoding and 5.8x faster decoding with a 4,096-symbol alphabet when instances are reused. Long Base62 conversion is broadly similar. Default construction costs about 2 additional microseconds; batch usage should reuse instances. Results depend on workload and engine.

See the migration guide and changelog.

Install with pnpm add numbase@1.1.0 or npm install numbase@1.1.0.

v1.0.0

Choose a tag to compare

@oe oe released this 03 Oct 15:27
4c4b11d

NumBase 1.0.0 provides one safe conversion API: encode(), decode(), and convert() return strings or throw. Large integers can be passed as decimal strings or bigint; unsafe Numbers are rejected.

Breaking changes

  • Invalid inputs no longer pass through unchanged; coercible objects are rejected.
  • Radices must be numeric integers. Omit the argument to use the default; string/null radices are rejected.
  • Decoding requires a nonempty encoded string; empty and sign-only input are rejected.
  • Explicit alphabets must contain at least two unique symbols and no negative sign. Empty/null alphabets are rejected.
  • Mutable alphabet/radix configuration is validated before conversion.
  • The unpublished encodeStrict() and decodeStrict() methods are removed; validation is now the default.

Valid encodings retain the original Base62 order (0–9, a–z, A–Z), UTF-16 defaults, negative signs, string negative zero, and leading-zero normalization.

Improvements

  • Native BigInt acceleration with an exact string fallback for older runtimes.
  • Alphabet-to-alphabet conversion and optional Unicode code-point alphabets.
  • Generated TypeScript declarations and native ESM, alongside CommonJS/browser/AMD/CMD and existing deep imports.
  • TypeScript + Vite + pnpm development, Vitest/V8 coverage and Node 22/24 CI.

All 33 tests pass, with 100% statements, branches, functions, and lines, enforced per file. Zero runtime dependencies; minified output is approximately 5 KB, 2 KB gzip.

See the migration guide and changelog.

Install with npm install numbase@1.0.0 or pnpm add numbase@1.0.0.