typescript-eslint 2 (#462)
* typescript-eslint 2 * startsWith fixes * padStart/padEnd
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
* u8aFixLength('0x1234', 8) // => 0x12
|
||||
* ```
|
||||
*/
|
||||
export default function u8aFixLength (value: Uint8Array, bitLength: number = -1, atStart: boolean = false): Uint8Array {
|
||||
export default function u8aFixLength (value: Uint8Array, bitLength = -1, atStart = false): Uint8Array {
|
||||
const byteLength = Math.ceil(bitLength / 8);
|
||||
|
||||
if (bitLength === -1 || value.length === byteLength) {
|
||||
|
||||
@@ -21,6 +21,5 @@ export default function u8aToBuffer (value?: Uint8Array | null): Buffer {
|
||||
return Buffer.from([]);
|
||||
}
|
||||
|
||||
// @ts-ignore yes, from also works with u8a
|
||||
return Buffer.from(value);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ const ALPHABET = '0123456789abcdef';
|
||||
* u8aToHex(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0xf])); // 0x68656c0f
|
||||
* ```
|
||||
*/
|
||||
export default function u8aToHex (value?: Uint8Array | null, bitLength: number = -1, isPrefixed: boolean = true): string {
|
||||
export default function u8aToHex (value?: Uint8Array | null, bitLength = -1, isPrefixed = true): string {
|
||||
const prefix = isPrefixed
|
||||
? '0x'
|
||||
: '';
|
||||
|
||||
Reference in New Issue
Block a user