Remove unnecessary `new RegExp` now that the pattern is a `RegExp` already.

This commit is contained in:
Bruno Bernardino 2022-03-09 21:51:08 +00:00
parent 9235543838
commit 2116565979
No known key found for this signature in database
GPG Key ID: D1B0A69ADD114ECE
1 changed files with 1 additions and 1 deletions

View File

@ -319,7 +319,7 @@ export function guessFieldType({
}
let matchedTypeByValue = Object.keys(FIELD_DEFS).filter((fieldType) =>
new RegExp(FIELD_DEFS[fieldType].pattern, "i").test(value)
FIELD_DEFS[fieldType].pattern.test(value)
)[0] as FieldType;
if (value !== "" && matchedTypeByValue) {