Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

base-conv

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base-conv - npm Package Compare versions

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;

2

package.json
{
"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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc