@thi.ng/base-n
Advanced tools
Comparing version 2.5.10 to 2.5.11
@@ -5,2 +5,3 @@ export const defBase = (chars) => new BaseN(chars); | ||
const SHIFT = BigInt(8); | ||
const MAX_SAFE_INT = BigInt(2 ** 53 - 1); | ||
/** @internal */ | ||
@@ -26,3 +27,3 @@ export const __B16_LC_CHARS = "0123456789abcdef"; | ||
encodeBigInt(x, size = 0) { | ||
if (x < BigInt(2 ** 53)) | ||
if (x <= MAX_SAFE_INT) | ||
return this.encode(Number(x), size); | ||
@@ -79,4 +80,7 @@ const { base, N } = this; | ||
/** @internal */ | ||
const __pad = (x, size, fill) => size - x.length > 0 ? fill.repeat(size - x.length) + x : x; | ||
const __pad = (x, size, fill) => { | ||
const d = size - x.length; | ||
return d > 0 ? fill.repeat(d) + x : x; | ||
}; | ||
/** @internal */ | ||
const __u8 = (x) => __B16_LC_CHARS[(x >>> 4) & 0xf] + __B16_LC_CHARS[x & 0xf]; |
# Change Log | ||
- **Last updated**: 2023-08-12T13:14:08Z | ||
- **Last updated**: 2023-08-14T13:30:45Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -12,2 +12,8 @@ | ||
### [2.5.11](https://github.com/thi-ng/umbrella/tree/@thi.ng/base-n@2.5.11) (2023-08-14) | ||
#### ⏱ Performance improvements | ||
- minor internal updates .encodeBigInt() ([43e9a7f](https://github.com/thi-ng/umbrella/commit/43e9a7f)) | ||
### [2.5.10](https://github.com/thi-ng/umbrella/tree/@thi.ng/base-n@2.5.10) (2023-08-12) | ||
@@ -14,0 +20,0 @@ |
{ | ||
"name": "@thi.ng/base-n", | ||
"version": "2.5.10", | ||
"version": "2.5.11", | ||
"description": "Arbitrary base-n conversions w/ presets for base8/16/32/36/58/62/64/85, support for bigints and encoding/decoding of byte arrays", | ||
@@ -110,3 +110,3 @@ "type": "module", | ||
}, | ||
"gitHead": "399f8c53d66b9b763d16c21bb59f145df5f59514\n" | ||
"gitHead": "4e8f1abeeba7b919e069954eada917ecd2e9a8e9\n" | ||
} |
@@ -54,3 +54,3 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
Package sizes (brotli'd, pre-treeshake): ESM: 944 bytes | ||
Package sizes (brotli'd, pre-treeshake): ESM: 939 bytes | ||
@@ -57,0 +57,0 @@ ## Dependencies |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32411
376