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

base-65503

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base-65503 - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

12

lib/index.js

@@ -9,5 +9,5 @@ (function (global, factory) {

const BASE = 65535 - OFFSET;
let alpha = [];
let alphabet = [];
for (let i = 0; i < BASE; i++) {
alpha.push(String.fromCharCode(i + OFFSET));
alphabet.push(String.fromCharCode(i + OFFSET));
}

@@ -17,14 +17,14 @@ const encode = exports.encode = num => {

if (typeof num !== 'number') num = ~num;
const base = alpha.length;
const base = alphabet.length;
let str = '';
while (num >= base) {
const mod = num % base;
str = alpha[mod] + str;
str = alphabet[mod] + str;
num = (num - mod) / base;
}
return alpha[num] + str
return alphabet[num] + str
};
const decode = exports.decode = str => {
let num = 0;
while(str) {
while (str) {
let pos = str[0].charCodeAt(0) - OFFSET;

@@ -31,0 +31,0 @@ if (pos < 0) throw new Error(`Can't find ${str[0]}`)

{
"name": "base-65503",
"version": "1.0.3",
"version": "1.0.4",
"description": "Base 65503 encoder & decoder for numbers",

@@ -5,0 +5,0 @@ "main": "lib/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