Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Node js implementation of BigBit standard with online convertion and comparision tool

License

Notifications You must be signed in to change notification settings

bigbit/bigbitjs

Repository files navigation

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 ]);

About

Node js implementation of BigBit standard with online convertion and comparision tool

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

AltStyle によって変換されたページ (->オリジナル) /