@punks/backend-entity-manager 0.0.412 → 0.0.413
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -40990,9 +40990,11 @@ const fieldTextValidator = (item, selector, params) => {
|
|
|
40990
40990
|
const length = typeof value === "string" ? value.length : 0;
|
|
40991
40991
|
const isMinLengthValid = length >= (params.minLength ?? 0);
|
|
40992
40992
|
const isMaxLengthValid = length <= (params.maxLength ?? Infinity);
|
|
40993
|
-
const isRegexValid = (
|
|
40993
|
+
const isRegexValid = ((!params.required && !value) ||
|
|
40994
|
+
(typeof value === "string" && params.regex?.test(value))) ??
|
|
40995
|
+
true;
|
|
40994
40996
|
return {
|
|
40995
|
-
isValid: isMinLengthValid && isMaxLengthValid && isRegexValid,
|
|
40997
|
+
isValid: isMinLengthValid && isMaxLengthValid && isRegexValid && isRequiredValid,
|
|
40996
40998
|
validationErrors: [
|
|
40997
40999
|
...(isRequiredValid ? [] : [{ errorCode: "required" }]),
|
|
40998
41000
|
...(isMinLengthValid
|