Comparing version 2.0.1 to 3.0.0-1
10
index.js
@@ -7,12 +7,12 @@ const DEFAULT_ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_'; | ||
* Convert a string or number from srcRadix to dstRadix | ||
* @param {string} [inputAlphabet=DEFAULT_ALPHABET] alphabet of the input string | ||
* @param {string} [inputAlphabet='0123456789abcdef'] alphabet of the input string | ||
* @param {string} [outputAlphabet=DEFAULT_ALPHABET] alphabet to buse for the output string | ||
* @returns {(input: string | number, inputBase?: number, outputBase?: number) => string} | ||
*/ | ||
function BaseConv(inputAlphabet = DEFAULT_ALPHABET, outputAlphabet = inputAlphabet) { | ||
module.exports = function BaseConv(_str = '', inputAlphabet = '0123456789abcdef', outputAlphabet = DEFAULT_ALPHABET) { | ||
// char => position map, to avoid calling a O(n) indexOf | ||
const inputAlphabetMap = new Map(Array.from(inputAlphabet, (s, i) => [s, i])); | ||
return (_str = '', inputBase = 10, outputBase = outputAlphabet.length) => { | ||
if (outputBase > outputAlphabet.length) throw new Error(`Output radix exceeds the output alphabet length (${outputAlphabet.length})`); | ||
return (_str = '', inputBase = inputAlphabet.length, outputBase = outputAlphabet.length) => { | ||
if (outputBase > outputAlphabet.length) throw new Error(`Output radix exceeds the outputAlphabet length (${outputAlphabet.length})`); | ||
@@ -50,3 +50,1 @@ const res = []; | ||
} | ||
module.exports = BaseConv; |
{ | ||
"name": "base-conv", | ||
"version": "2.0.1", | ||
"version": "3.0.0-1", | ||
"description": "Convert arbitrarily large numbers from any radix representation to any other", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
4774
70
1