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

@navpreetdevpuri/base-2-n

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@navpreetdevpuri/base-2-n - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

6

lib/index.js

@@ -38,3 +38,3 @@ "use strict";

this.digits[j] = digits.charCodeAt(i);
if (this.digits[j] > this.base) {
if (this.digits[j] >= this.base) {
throw new Error("Any digit's ASCII code in given digits can't be more than or equal to given base: ".concat(this.base, ". ASCII code ").concat(this.digits[j], " > base ").concat(this.base));

@@ -75,3 +75,3 @@ }

var curr = this.digits[i] + other.digits[i] + carry;
if (curr > this.base) {
if (curr >= this.base) {
result[i] = curr - this.base;

@@ -91,3 +91,3 @@ carry = 1;

for (var i = 0; i < this.maxNoOfDigits; i += 1) {
var curr = (this.digits[i] >> 1) | (carry << 15);
var curr = (this.digits[i] >> 1) | (carry << (this.n - 1));
carry = this.digits[i] & 1;

@@ -94,0 +94,0 @@ result[i] = curr;

{
"name": "@navpreetdevpuri/base-2-n",
"version": "1.0.4",
"version": "1.0.5",
"description": "To work with base 2^n numbers",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -52,3 +52,3 @@ class Base2N {

this.digits[j] = digits.charCodeAt(i);
if (this.digits[j] > this.base) {
if (this.digits[j] >= this.base) {
throw new Error(

@@ -93,3 +93,3 @@ `Any digit's ASCII code in given digits can't be more than or equal to given base: ${this.base}. ASCII code ${this.digits[j]} > base ${this.base}`

const curr = this.digits[i] + other.digits[i] + carry;
if (curr > this.base) {
if (curr >= this.base) {
result[i] = curr - this.base;

@@ -109,3 +109,3 @@ carry = 1;

for (let i = 0; i < this.maxNoOfDigits; i += 1) {
const curr = (this.digits[i] >> 1) | (carry << 15);
const curr = (this.digits[i] >> 1) | (carry << (this.n - 1));
carry = this.digits[i] & 1;

@@ -112,0 +112,0 @@ result[i] = curr;

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