Make isLe required in conversion (#180)
* Make isLe required in conversion * Update logger Date format * Fallback encoding sizes
This commit is contained in:
@@ -5,10 +5,11 @@
|
||||
import { u8aToBn } from './index';
|
||||
|
||||
describe('u8aToBn', () => {
|
||||
it('converts values', () => {
|
||||
it('converts values (big-endian)', () => {
|
||||
expect(
|
||||
u8aToBn(
|
||||
new Uint8Array([0x12, 0x34])
|
||||
new Uint8Array([0x12, 0x34]),
|
||||
false
|
||||
).toString(16)
|
||||
).toEqual('1234');
|
||||
});
|
||||
@@ -25,12 +26,13 @@ describe('u8aToBn', () => {
|
||||
it('converts empty', () => {
|
||||
expect(
|
||||
u8aToBn(
|
||||
new Uint8Array([])
|
||||
new Uint8Array([]),
|
||||
true
|
||||
).toString(16)
|
||||
).toEqual('0');
|
||||
});
|
||||
|
||||
it('handled overflows correctly', () => {
|
||||
it('handled overflows correctly (little-endian)', () => {
|
||||
expect(
|
||||
u8aToBn(
|
||||
new Uint8Array([ 0, 1, 0, 0, 0, 0, 0, 0 ]),
|
||||
|
||||
@@ -18,7 +18,7 @@ import u8aToHex from './toHex';
|
||||
*
|
||||
* u8aToHex(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0xf])); // 0x68656c0f
|
||||
*/
|
||||
export default function u8aToBn (value?: Uint8Array, isLe: boolean = false): BN {
|
||||
export default function u8aToBn (value: Uint8Array, isLe: boolean): BN {
|
||||
return hexToBn(
|
||||
u8aToHex(value),
|
||||
isLe
|
||||
|
||||
Reference in New Issue
Block a user