Fix linting and add new lint rules

This commit is contained in:
Dolan Miu
2022-09-19 20:48:50 +01:00
parent e90d97b813
commit 5950055cca
13 changed files with 78 additions and 46 deletions

View File

@ -32,7 +32,7 @@ export const unsignedDecimalNumber = (val: number): number => {
// http://www.datypic.com/sc/xsd/t-xsd_hexBinary.html
const hexBinary = (val: string, length: number): string => {
const expectedLength = length * 2;
if (val.length !== expectedLength || isNaN(Number("0x" + val))) {
if (val.length !== expectedLength || isNaN(Number(`0x${val}`))) {
throw new Error(`Invalid hex value '${val}'. Expected ${expectedLength} digit hex value`);
}
return val;