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

bigint-browserify

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bigint-browserify - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

21

index.js

@@ -24,2 +24,22 @@ var jsbn = require('jsbn');

},
eq: function(a) {
if (!a._jsbn) a = new BigInt(a);
return this._jsbn.equals(a._jsbn);
},
cmp: function(a) {
if (!a._jsbn) a = new BigInt(a);
return this._jsbn.compareTo(a._jsbn);
},
gt: function(a) {
return this.cmp(a) > 0;
},
ge: function(a) {
return this.cmp(a) >= 0;
},
lt: function(a) {
return this.cmp(a) < 0;
},
le: function(a) {
return this.cmp(a) <= 0;
},
bitLength: function() {

@@ -30,2 +50,3 @@ return this._jsbn.bitLength();

var hex = this._jsbn.toString(16);
if (hex.length % 2) hex = '0' + hex;
return new Buffer(hex, 'hex');

@@ -32,0 +53,0 @@ },

2

package.json
{
"name": "bigint-browserify",
"version": "0.0.1",
"version": "0.0.2",
"description": "bigint api for browser javascript",

@@ -5,0 +5,0 @@ "repository": {

@@ -22,2 +22,4 @@ var test = require("tape");

// operations
['add', 'sub', 'mul', 'mod', 'xor', 'powm']

@@ -40,2 +42,28 @@ .forEach(function(name) {

// comparisons
assertSame('eq', function(bigint, cb) {
var ba = bigint(a, 16);
var bb = bigint(b, 16);
cb(null, ba.eq(bb) && ba.eq(ba));
});
['cmp', 'gt', 'ge', 'lt', 'le']
.forEach(function(name) {
assertSame(name, function(bigint, cb) {
var ba = bigint(a, 16);
var bb = bigint(b, 16);
cb(null, ba[name](bb) && bb[name](ba) && ba[name](ba));
});
assertSame('bigint.' + name, function(bigint, cb) {
var ba = bigint(a, 16);
var bb = bigint(b, 16);
cb(null, bigint[name](ba, bb) && bigint[name](bb, ba) && bigint[name](ba, ba));
});
});
// misc
assertSame('bitLength', function(bigint, cb) {

@@ -42,0 +70,0 @@ var ba = bigint(a, 16);

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