Skip to content

Commit 1d40229

Browse files
committed
feat: improve boolean validator by parsing boolean from string
1 parent 5f0bfdf commit 1d40229

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/validation/validators/boolean.validator.ts

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export const BooleanValidator: BooleanValidator = {
99
validateAndParse: function(value) {
1010
if (typeof value === 'boolean') {
1111
return value;
12+
} else if (/true/i.test(value)) {
13+
return true;
14+
} else if (/false/i.test(value)) {
15+
return false;
1216
} else {
1317
throw new PropertyValidationError({ value, type: this.type });
1418
}

0 commit comments

Comments
 (0)