Make isLe required in conversion (#180)

* Make isLe required in conversion

* Update logger Date format

* Fallback encoding sizes
This commit is contained in:
Jaco Greeff
2018-07-27 12:03:11 +02:00
committed by GitHub
parent 634ae7995f
commit cf570fd729
12 changed files with 25 additions and 19 deletions
+6 -4
View File
@@ -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 ]),
+1 -1
View File
@@ -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