@punks/backend-entity-manager 0.0.496 → 0.0.499
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
CHANGED
|
@@ -41164,25 +41164,24 @@ const fieldRequiredValidator = (item, selector) => {
|
|
|
41164
41164
|
};
|
|
41165
41165
|
const fieldNumericValidator = (item, selector, params) => {
|
|
41166
41166
|
const value = selector(item);
|
|
41167
|
-
const isInvalid = value && !isNaN(value);
|
|
41168
41167
|
const errors = [];
|
|
41169
|
-
if (value && isNaN(value)) {
|
|
41168
|
+
if (!!value && isNaN(value)) {
|
|
41170
41169
|
errors.push({ errorCode: "notNumeric" });
|
|
41171
41170
|
}
|
|
41172
|
-
if (!!params
|
|
41171
|
+
if (!!params?.min && !!value && value < params.min) {
|
|
41173
41172
|
errors.push({
|
|
41174
41173
|
errorCode: "min",
|
|
41175
41174
|
payload: { current: value, expected: params.min },
|
|
41176
41175
|
});
|
|
41177
41176
|
}
|
|
41178
|
-
if (!!params
|
|
41177
|
+
if (!!params?.max && !!value && value > params.max) {
|
|
41179
41178
|
errors.push({
|
|
41180
41179
|
errorCode: "max",
|
|
41181
41180
|
payload: { current: value, expected: params.max },
|
|
41182
41181
|
});
|
|
41183
41182
|
}
|
|
41184
41183
|
return {
|
|
41185
|
-
isValid:
|
|
41184
|
+
isValid: errors.length === 0,
|
|
41186
41185
|
validationErrors: errors,
|
|
41187
41186
|
};
|
|
41188
41187
|
};
|