Add u8a-only strict variants (#1503)

This commit is contained in:
Jaco
2022-05-25 10:02:01 +03:00
committed by GitHub
parent 2698f6779f
commit fbf973dc2a
20 changed files with 105 additions and 37 deletions
+8 -2
View File
@@ -22,8 +22,14 @@ import { u8aToU8a } from './toU8a';
* ```
*/
export function u8aCmp (a: HexString | Uint8Array | string, b: HexString | Uint8Array | string): number {
const u8aa = u8aToU8a(a);
const u8ab = u8aToU8a(b);
return u8aCmpStrict(u8aToU8a(a), u8aToU8a(b));
}
/**
* @name u8aCmpStrict
* @description A strict version of [[u8aCmp]], accepting only Uint8Array inputs
*/
export function u8aCmpStrict (u8aa: Uint8Array, u8ab: Uint8Array): number {
let i = 0;
while (true) {