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

bigbit

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bigbit

Implementation of BigBit standard for numeric data type and character encoding

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by150%
Maintainers
1
Weekly downloads
 
Created
Source

BigBit

An improved data type to save large numbers in less space without precision loss. check more detail here. Or try the demo

var HBSequence = require('bigbit').HeaderByte;

let hb = new HBSequence('167770021700.00');
expect( hb.toString() ).toEqual('167770021700');
expect( hb.toByteArray() ).toEqual([69, 2, 121, 172, 255, 99]);
expect( HBSequence.decode( hb.toByteArray() ).toString() ).toEqual('167770021700'); //decode( byteArray, index[, maxNumberOfBytes ]);
expect( hb.exponent ).toEqual( 2 );
expect( hb.exponentInBytes ).toEqual( 2 );
expect( hb.headByte ).toEqual(69);

var EHBSequence = require('bigbit').ExtendedHeaderByte;

let ehb = new EHBSequence('167770021700.00');
expect( ehb.toString() ).toEqual('167770021700');
expect( ehb.toByteArray() ).toEqual([69, 2, 121, 172, 255, 99]);
expect( EHBSequence.decode( hb.toByteArray() ).toString() ).toEqual('167770021700.00'); //decode( byteArray, index[, maxNumberOfBytes ]);
expect( ehb.exponent ).toEqual( 2 );
expect( ehb.exponentInBytes ).toEqual( [2] );
expect( ehb.headByte ).toEqual(69);

var LBSequence = require('bigbit').LinkedBytes;
expect( LBSequence.encode('123000')  ).toEqual( [ 248, 192, 7]);
expect( LBSequence.decode([ 248, 192, 7])  ).toEqual({ val: '123000', len: 3});  //decode( byteArray, index[, maxNumberOfBytes ]);

Keywords

FAQs

Package last updated on 05 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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