TextEncoder allows non-Uint8Array Buffers (#596)
* TextEncoder allows non-Uint8Array Buffers * Add eslintrc to eslintignore
This commit is contained in:
@@ -8,25 +8,25 @@ describe('numberToU8a', (): void => {
|
||||
it('converts 0 to empty', (): void => {
|
||||
expect(
|
||||
numberToU8a(0)
|
||||
).toEqual(new Uint8Array([]));
|
||||
).toEqual(new Uint8Array());
|
||||
});
|
||||
|
||||
it('converts undefined to empty', (): void => {
|
||||
expect(
|
||||
numberToU8a()
|
||||
).toEqual(new Uint8Array([]));
|
||||
).toEqual(new Uint8Array());
|
||||
});
|
||||
|
||||
it('converts null to empty', (): void => {
|
||||
expect(
|
||||
numberToU8a(null)
|
||||
).toEqual(new Uint8Array([]));
|
||||
).toEqual(new Uint8Array());
|
||||
});
|
||||
|
||||
it('converts NaN to empty', (): void => {
|
||||
expect(
|
||||
numberToU8a(NaN)
|
||||
).toEqual(new Uint8Array([]));
|
||||
).toEqual(new Uint8Array());
|
||||
});
|
||||
|
||||
it('converts values to the u8a', (): void => {
|
||||
|
||||
@@ -21,7 +21,7 @@ import numberToHex from './toHex';
|
||||
*/
|
||||
export default function numberToU8a (value?: number | null, bitLength = -1): Uint8Array {
|
||||
if (!value || isNaN(value)) {
|
||||
return new Uint8Array([]);
|
||||
return new Uint8Array();
|
||||
}
|
||||
|
||||
return hexToU8a(
|
||||
|
||||
Reference in New Issue
Block a user