Convert assert to if + throw (remaining occurences) (#1622)

* Convert assert to if + throw (remaining occurences)

* Adjust for readability

* CHANGELOG
This commit is contained in:
Jaco
2022-08-04 10:45:10 +03:00
committed by GitHub
parent 2d4509c32a
commit c08c947abf
19 changed files with 128 additions and 71 deletions
+3 -3
View File
@@ -1,8 +1,6 @@
// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { assert } from '@polkadot/util';
import { DeriveJunction } from './DeriveJunction';
const RE_JUNCTION = /\/(\/?)([^/]+)/g;
@@ -28,7 +26,9 @@ export function keyExtractPath (derivePath: string): ExtractResult {
}
}
assert(constructed === derivePath, () => `Re-constructed path "${constructed}" does not match input`);
if (constructed !== derivePath) {
throw new Error(`Re-constructed path "${constructed}" does not match input`);
}
return {
parts,