Skip to content

Commit

Permalink
default applies only to undefined values
Browse files Browse the repository at this point in the history
BREAKING CHANGE: default rule will now only apply the default if the value is undefined. This means empty strings are no longer replaced with this rule.
  • Loading branch information
tyler-johnson committed Sep 13, 2018
1 parent fef579c commit 139339a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/rules/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ const defaultRule: Rule = {
},
transform(value, field) {
const def = field.props.get("default");

return (typeof def !== "undefined") &&
(typeof value === "undefined" || value === "") ?
def : value;
return typeof value === "undefined" ? def : value;
}
};

Expand Down

0 comments on commit 139339a

Please sign in to comment.