make isValidString use trim instead of regex

This commit is contained in:
Andrew Thauer
2021-01-28 10:27:22 -05:00
parent 1362709953
commit 13c59b82b3
@@ -106,7 +106,7 @@ export class CommonValidatorFunctions {
try {
const url = new URL(value);
return !!url;
} catch (_) {
} catch {
return false;
}
}
@@ -117,10 +117,6 @@ export class CommonValidatorFunctions {
* @param value The value to check
*/
static isValidString(value: unknown): boolean {
return (
typeof value === 'string' &&
value.length >= 1 &&
/^(?!\s*$).+/.test(value)
);
return typeof value === 'string' && value?.trim()?.length >= 1;
}
}