From 6defb686bbdad4988fb8a5a2da3ede0f82aa1c20 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 5 Jan 2023 21:39:46 +0000 Subject: [PATCH] Remove unessesary checks for values --- src/util/values.ts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/util/values.ts b/src/util/values.ts index ab0cd20b58..4776210e69 100644 --- a/src/util/values.ts +++ b/src/util/values.ts @@ -89,16 +89,9 @@ export const uCharHexNumber = (val: string): string => hexBinary(val, 1); // export const universalMeasureValue = (val: UniversalMeasure): UniversalMeasure => { const unit = val.slice(-2); - if (!universalMeasureUnits.includes(unit)) { - throw new Error(`Invalid unit '${unit}' specified. Valid units are ${universalMeasureUnits.join(", ")}`); - } const amount = val.substring(0, val.length - 2); - if (isNaN(Number(amount))) { - throw new Error(`Invalid value '${amount}' specified. Expected a valid number.`); - } return `${Number(amount)}${unit}` as UniversalMeasure; }; -const universalMeasureUnits = ["mm", "cm", "in", "pt", "pc", "pi"]; // // @@ -167,13 +160,7 @@ export const twipsMeasureValue = (val: PositiveUniversalMeasure | number): Posit // // export const percentageValue = (val: Percentage): Percentage => { - if (val.slice(-1) !== "%") { - throw new Error(`Invalid value '${val}'. Expected percentage value (eg '55%')`); - } const percent = val.substring(0, val.length - 1); - if (isNaN(Number(percent))) { - throw new Error(`Invalid value '${percent}' specified. Expected a valid number.`); - } return `${Number(percent)}%`; };