Object values return undefined

This commit is contained in:
Jaco Greeff
2018-08-11 23:56:45 +02:00
parent 443a88e702
commit a7dd6edcf6
4 changed files with 8 additions and 12 deletions
@@ -9,9 +9,8 @@ import u8aToBn from '@polkadot/util/u8a/toBn';
export default function bytes (input: Uint8Array | null): Param$Decoded {
if (input === null) {
return {
length: 0,
value: new Uint8Array()
};
length: 0
} as Param$Decoded;
}
const length = u8aToBn(input.subarray(0, 4), true).toNumber();
@@ -9,9 +9,8 @@ import u8aToBn from '@polkadot/util/u8a/toBn';
export default function code (input: Uint8Array | null): Param$Decoded {
if (input === null) {
return {
length: 0,
value: new Uint8Array()
};
length: 0
} as Param$Decoded;
}
const length = u8aToBn(input.subarray(0, 4), true).toNumber() + 4;
@@ -10,9 +10,8 @@ import u8aToUtf8 from '@polkadot/util/u8a/toUtf8';
export default function string (input: Uint8Array | null): Param$Decoded {
if (input === null) {
return {
length: 0,
value: ''
};
length: 0
} as Param$Decoded;
}
const length = u8aToBn(input.subarray(0, 4), true).toNumber();
+2 -3
View File
@@ -7,9 +7,8 @@ import { Param$Decoded } from '../../types';
export default function u8a (input: Uint8Array | null, bitLength: 256 | 512, offset: number): Param$Decoded {
if (input === null) {
return {
length: 0,
value: new Uint8Array()
};
length: 0
} as Param$Decoded;
}
const length = (bitLength / 8) + offset;