Sqlite upgrade and type refactorings

This commit is contained in:
baldo 2022-07-18 17:49:42 +02:00
commit 28c8429edd
20 changed files with 873 additions and 663 deletions

View file

@ -17,7 +17,11 @@ export function normalizeMac (mac: string): string {
return macParts.join(':');
}
export function parseInteger (str: string): number | undefined {
export function parseInteger (str: string): number {
const parsed = _.parseInt(str, 10);
return parsed.toString() === str ? parsed : undefined;
if (parsed.toString() === str) {
return parsed;
} else {
throw new SyntaxError(`String does not represent a valid integer: "${str}"`);
}
}