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

bigintjs

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bigintjs - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

.npmignore

49

index.js

@@ -0,1 +1,3 @@

var arrayCopy = require('./lib/arraycopy');
module.exports = BigInt;

@@ -7,3 +9,2 @@

BASE = 1 << BITS,
MASK = BASE - 1,
DECIMAL_SHIFT = 4,

@@ -37,43 +38,3 @@ DECIMAL_BASE = 10000;

} else if (Array.isArray(opt_value)) {
var numItems = opt_value.length;
if (!opt_bitsPerItem) opt_bitsPerItem = 8;
if (opt_bitsPerItem < 1 || opt_bitsPerItem > 32) {
throw new Error('Bits per item must be in range 1–32');
}
var totalBits = numItems * opt_bitsPerItem;
digits = new Uint16Array(Math.ceil(totalBits / BITS));
var index = 0,
bits = totalBits % BITS || BITS;
for (var i = 0; i < numItems; i++) {
var value = opt_value[i];
var overflow = opt_bitsPerItem - bits;
if (overflow < 0) {
digits[index] |= value << -overflow >>> 0 & MASK;
} else {
digits[index] |= value >>> overflow & MASK;
}
while (overflow > 0) {
index++;
if (overflow < BITS) {
digits[index] = value << (BITS - overflow) >>> 0 & MASK;
} else {
digits[index] = value >>> (overflow - BITS) & MASK;
}
overflow -= BITS;
}
bits -= opt_bitsPerItem;
while (bits < 0) bits += BITS;
}
digits = arrayCopy(opt_value, opt_bitsPerItem || 8, BITS);
this.negative = false;

@@ -116,2 +77,6 @@ }

BigInt.prototype.toBytes = function (opt_destArray) {
return arrayCopy(this.digits, BITS, 8, opt_destArray);
};
BigInt.prototype.toJSON = function () {

@@ -118,0 +83,0 @@ return this.valueOf();

{
"name": "bigintjs",
"version": "0.1.1",
"version": "0.1.2",
"description": "Allows working with integers of any size.",

@@ -16,4 +16,8 @@ "main": "index.js",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "vows test/* --spec"
},
"devDependencies": {
"assert": "^1.1.1",
"vows": "~0.7.0"
}
}

@@ -1,2 +0,2 @@

BigInt
BigInt [![Build Status Image][]][Build Status]
======

@@ -48,2 +48,4 @@

[Browserify]: http://browserify.org/
[Build Status]: https://travis-ci.org/blixt/js-bigint
[Build Status Image]: https://api.travis-ci.org/blixt/js-bigint.png?branch=master
[NPM]: https://www.npmjs.org/
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