Skip to content

Commit 8e2c207

Browse files
committed
simplifying logic, same output.
1 parent 430949c commit 8e2c207

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

lib/Validator.js

+7-10
Original file line numberDiff line numberDiff line change
@@ -236,20 +236,17 @@ class Validator {
236236
);
237237

238238
const validate = (value) => {
239-
if (slotDefinition.required && !value) {
240-
return 'This field is required';
241-
}
242-
243-
if (slotDefinition.value_presence === 'PRESENT' && !value) {
244-
return 'Value is not present';
245-
} else if (slotDefinition.value_presence === 'ABSENT' && value) {
246-
return 'Value is not absent';
247-
}
248-
249239
if (!value) {
240+
if (slotDefinition.required)
241+
return 'This field is required';
242+
if (slotDefinition.value_presence === 'PRESENT')
243+
return 'Value is not present';
250244
return;
251245
}
252246

247+
if (slotDefinition.value_presence === 'ABSENT')
248+
return 'Value is not absent';
249+
253250
let splitValues;
254251
if (slotDefinition.multivalued) {
255252
splitValues = value.split(this.#multivaluedDelimiter);

0 commit comments

Comments
 (0)