Adjust isHex with template return (#1103)

* Adjust isHex with template return

* Unneeded assignment

* CHANGELOG

* typo

* Additional HexString types

* Additional HexString inputs

* Use U8aLike as applicable

* typo

* Unneeded type

* HexString outputs

* Export types
This commit is contained in:
Jaco
2021-09-08 14:38:53 +02:00
committed by GitHub
parent 6b9b7fa7f5
commit 9fc57a23e8
71 changed files with 233 additions and 122 deletions
+3 -1
View File
@@ -1,6 +1,8 @@
// Copyright 2017-2021 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { U8aLike } from '../types';
import { BN, BN_FOUR } from '../bn';
import { u8aToBn, u8aToU8a } from '../u8a';
@@ -18,7 +20,7 @@ import { u8aToBn, u8aToU8a } from '../u8a';
* console.log('value offset=', offset, 'length=', length); // 4, 0xffff
* ```
*/
export function compactFromU8a (_input: Buffer | Uint8Array | string | number[]): [number, BN] {
export function compactFromU8a (_input: U8aLike): [number, BN] {
const input = u8aToU8a(_input);
const flag = input[0] & 0b11;