Skip to content

Commit

Permalink
refactor: Simplify expression by nullish coalescing operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Mosoc committed Jan 14, 2020
1 parent e2d948f commit dc7c673
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Checkbox.tsx
Expand Up @@ -18,7 +18,7 @@ export const fieldToCheckbox = ({
...props
}: CheckboxProps): MuiCheckboxProps => {
return {
disabled: disabled != undefined ? disabled : isSubmitting,
disabled: disabled ?? isSubmitting,
...props,
...field,
// TODO handle indeterminate
Expand Down
2 changes: 1 addition & 1 deletion src/InputBase.tsx
Expand Up @@ -15,7 +15,7 @@ export const fieldToInputBase = ({
...props
}: InputBaseProps): MuiInputBaseProps => {
return {
disabled: disabled != undefined ? disabled : isSubmitting,
disabled: disabled ?? isSubmitting,
...props,
...field,
};
Expand Down
2 changes: 1 addition & 1 deletion src/Select.tsx
Expand Up @@ -35,7 +35,7 @@ export const fieldToSelect = ({
);

return {
disabled: disabled != undefined ? disabled : isSubmitting,
disabled: disabled ?? isSubmitting,
...props,
...field,
onChange,
Expand Down
2 changes: 1 addition & 1 deletion src/Switch.tsx
Expand Up @@ -18,7 +18,7 @@ export const fieldToSwitch = ({
...props
}: SwitchProps): MuiSwitchProps => {
return {
disabled: disabled != undefined ? disabled : isSubmitting,
disabled: disabled ?? isSubmitting,
...props,
...field,
value: field.name,
Expand Down
2 changes: 1 addition & 1 deletion src/TextField.tsx
Expand Up @@ -28,7 +28,7 @@ export const fieldToTextField = ({
...field,
error: showError,
helperText: showError ? fieldError : props.helperText,
disabled: disabled != undefined ? disabled : isSubmitting,
disabled: disabled ?? isSubmitting,
};
};

Expand Down

0 comments on commit dc7c673

Please sign in to comment.