Skip to content

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.