Skip to content

Commit

Permalink
[added] string.ensure
Browse files Browse the repository at this point in the history
Coerce empty values to empty strings
  • Loading branch information
jquense committed Jun 24, 2016
1 parent f2b0078 commit 758ac51
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ inherits(StringSchema, MixedSchema, {
},

//-- transforms --
ensure() {
return this
.default('')
.transform(val => val === null ? '' : val)
},

trim(msg) {
msg = msg || locale.trim

Expand Down

0 comments on commit 758ac51

Please sign in to comment.