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

biguint-format

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

biguint-format - npm Package Compare versions

Comparing version 0.2.2 to 1.0.0

.istanbul.yml

22

index.js

@@ -12,2 +12,3 @@ /**

*/
/*jslint bitwise: true */
(function () {

@@ -62,12 +63,12 @@ "use strict";

// get rid of leading 0's; reuse d for the first non-zero value index
d = _lastHeadIndex(digits, 0);
var idx = _lastHeadIndex(digits, 0);
// if there are only 0's use the last digit
d = d >= 0 ? d : lastDigit;
idx = idx >= 0 ? idx : lastDigit;
// convert numbers to ascii digits
_toAsciiDigits(digits, d);
_toAsciiDigits(digits, idx);
return _pad(
_split(digits.toString('ascii', d), options.groupsize, options.delimiter),
_split(digits.toString('ascii', idx), options.groupsize, options.delimiter),
'', options.padstr, options.size);

@@ -99,3 +100,3 @@ }

if (size > 0) {
output = _split(output, size, options.delimiter)
output = _split(output, size, options.delimiter);
}

@@ -164,5 +165,6 @@

}
return (typeof string !== 'undefined' && +size > 0)
? string.replace(new RegExp('(.)(?=(.{' + +size + '})+(?!.))', 'g'), "$1" + delim)
: string;
if (typeof string !== 'undefined' && +size > 0) {
string = string.replace(new RegExp('(.)(?=(.{' + +size + '})+(?!.))', 'g'), "$1" + delim);
}
return string;
}

@@ -242,3 +244,3 @@

for (var i = buffer.length; i >= 0; i--) {
carry = (buffer[i] & 0x80) != 0;
carry = (buffer[i] & 0x80) !== 0;
buffer[i] = (buffer[i] << 1) & 0xFF;

@@ -258,3 +260,3 @@ if (carry && i >= 0) {

carry = prevcarry;
prevcarry = (buffer[i] & 0x1) != 0;
prevcarry = (buffer[i] & 0x1) !== 0;
buffer[i] >>= 1;

@@ -261,0 +263,0 @@ if (carry && i > 0) {

{
"name": "biguint-format",
"version": "0.2.2",
"version": "1.0.0",
"description": "An arbitrary length unsigned integer formatter library for Node.js",
"main": "index.js",
"scripts": {
"test": "node test.js"
"test": "istanbul cover _mocha --report lcovonly"
},

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

Big UInteger Formatter
====
[![Build Status](https://travis-ci.org/T-PWK/biguint-format.png?branch=master)](https://travis-ci.org/T-PWK/biguint-format) [![NPM version](https://badge.fury.io/js/biguint-format.png)](http://badge.fury.io/js/biguint-format) [![Total views](https://sourcegraph.com/api/repos/github.com/T-PWK/biguint-format/counters/views.png)](https://sourcegraph.com/github.com/T-PWK/biguint-format)
[![Build Status](https://travis-ci.org/T-PWK/biguint-format.svg?branch=master)](https://travis-ci.org/T-PWK/biguint-format) [![npm version](https://badge.fury.io/js/biguint-format.svg)](http://badge.fury.io/js/biguint-format) [![Dependency Status](https://gemnasium.com/T-PWK/biguint-format.svg)](https://gemnasium.com/T-PWK/biguint-format) [![Code Climate](https://codeclimate.com/github/T-PWK/biguint-format/badges/gpa.svg)](https://codeclimate.com/github/T-PWK/biguint-format) [![Test Coverage](https://codeclimate.com/github/T-PWK/biguint-format/badges/coverage.svg)](https://codeclimate.com/github/T-PWK/biguint-format)

@@ -26,6 +26,8 @@ An arbitrary length unsigned integer formatter library for Node.js.

```js
var biguint = require('biguint-format');
var format = require('biguint-format');
// 0x1234567890abcdeffedcba908765421 split into bytes
biguint.format([0x1, 0x23, 0x45, 0x67, 0x89, 0x0a, 0xbc, 0xde, 0xff, 0xed, 0xcb, 0xa9, 0x08, 0x76, 0x54, 0x21], 'dec')
format([
0x1, 0x23, 0x45, 0x67, 0x89, 0x0a, 0xbc, 0xde,
0xff, 0xed, 0xcb, 0xa9, 0x08, 0x76, 0x54, 0x21], 'dec')

@@ -54,2 +56,4 @@ // output value is '1512366075009453296626403467035300897' - no integer precision lose

If `format` argument is missing, `dec` format is used as a default option. Note that you will have to specify format if you would like to use `options` argument.
The `options` argument (optional) is an object which provides some additional conversion details:

@@ -128,2 +132,2 @@ * `format` - specifies format of the input number. It can be either `BE` for Big Endian or `LE` for Little Endian. `BE` is a default value. Check [wikipedia](http://en.wikipedia.org/wiki/Endianness) for more details.

MIT License : http://blog.tompawlak.org/p/mit.html
MIT License : http://blog.tompawlak.org/mit-license

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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