Comparing version 1.2.2 to 1.3.0
'use strict'; | ||
let CHARSET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
let CHARSET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_'; | ||
let CHARSET_MAP; // char => position map, to avoid calling indexOf | ||
@@ -24,3 +24,3 @@ | ||
const convert = (_str = '', src_base = 10, dst_base = CHARSET.length, safe) => { | ||
if (dst_base > CHARSET.length) throw new Error(`src or dst radix exceeds current charset length (${CHARSET.length})`); | ||
if (dst_base > CHARSET.length) throw new Error(`dst radix exceeds current charset length (${CHARSET.length})`); | ||
@@ -27,0 +27,0 @@ const res = []; |
{ | ||
"name": "base-conv", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Convert arbitrarily big numbers from any radix representation to any other", | ||
@@ -36,6 +36,6 @@ "main": "index.js", | ||
"@std/esm": "^0.26.0", | ||
"codecov": "^3.0.3", | ||
"nyc": "^12.0.2", | ||
"rollup": "^0.62.0" | ||
"codecov": "^3.1.0", | ||
"nyc": "^13.0.1", | ||
"rollup": "^0.66.0" | ||
} | ||
} |
@@ -7,3 +7,3 @@ # radix conversion | ||
- default charset is `'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'` (base62) | ||
- default charset is `'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_'` | ||
- you can change it with `conv.setCharset` | ||
@@ -17,3 +17,3 @@ - no IEEE-754 limitation | ||
console.log(conv('42', 10, 16)) // '2a' | ||
console.log(conv('42'.repeat(100), 10, 16)) // '8DE2991DF40FF7830578100...' | ||
console.log(conv('42'.repeat(100), 10, 16)) // '8de2991df40ff783057818d0012f3bc1c...' | ||
``` | ||
@@ -20,0 +20,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
6904
132