Skip to content

Commit 758ac51

Browse files
committed
[added] string.ensure
Coerce empty values to empty strings
1 parent f2b0078 commit 758ac51

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/string.js

+6
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ inherits(StringSchema, MixedSchema, {
8888
},
8989

9090
//-- transforms --
91+
ensure() {
92+
return this
93+
.default('')
94+
.transform(val => val === null ? '' : val)
95+
},
96+
9197
trim(msg) {
9298
msg = msg || locale.trim
9399

0 commit comments

Comments
 (0)