core&ui: fix empty pretest input

This commit is contained in:
undefined committed 2023-02-10 21:25:55 +08:00
1 parent f30a39593f
commit 478666bdf5
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -51,9 +51,9 @@ export interface Types {
}
const basicString = <T = string>(regex?: RegExp, cb?: (i: string) => boolean, convert?: (i: string) => T) => [
convert || ((v) => v.toString().trim()),
convert || ((v) => v.toString()),
(v) => {
const res = v.toString().trim();
const res = v.toString();
if (regex && !regex.test(res)) return false;
if (cb && !cb(res)) return false;
return !!res.length;