@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/esm/index.js
CHANGED
|
@@ -40975,9 +40975,11 @@ const fieldTextValidator = (item, selector, params) => {
|
|
|
40975
40975
|
const length = typeof value === "string" ? value.length : 0;
|
|
40976
40976
|
const isMinLengthValid = length >= (params.minLength ?? 0);
|
|
40977
40977
|
const isMaxLengthValid = length <= (params.maxLength ?? Infinity);
|
|
40978
|
-
const isRegexValid = (
|
|
40978
|
+
const isRegexValid = ((!params.required && !value) ||
|
|
40979
|
+
(typeof value === "string" && params.regex?.test(value))) ??
|
|
40980
|
+
true;
|
|
40979
40981
|
return {
|
|
40980
|
-
isValid: isMinLengthValid && isMaxLengthValid && isRegexValid,
|
|
40982
|
+
isValid: isMinLengthValid && isMaxLengthValid && isRegexValid && isRequiredValid,
|
|
40981
40983
|
validationErrors: [
|
|
40982
40984
|
...(isRequiredValid ? [] : [{ errorCode: "required" }]),
|
|
40983
40985
|
...(isMinLengthValid
|