Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Coding style: utilize default values

Lyubo Marinov1d128e027a41
diff --git a/react/features/base/dialog/components/AbstractDialog.js b/react/features/base/dialog/components/AbstractDialog.js
index 4d9bfa562f..3b32ea2570 100644
--- a/react/features/base/dialog/components/AbstractDialog.js
+++ b/react/features/base/dialog/components/AbstractDialog.js
@@ -86,10 +86,9 @@ export default class AbstractDialog<P : Props, S : State>
* @returns {void}
*/
_onCancel() {
- const { cancelDisabled, onCancel } = this.props;
+ const { cancelDisabled = false, onCancel } = this.props;
- if ((typeof cancelDisabled === 'undefined' || !cancelDisabled)
- && (!onCancel || onCancel())) {
+ if (!cancelDisabled && (!onCancel || onCancel())) {
this._hide();
}
}
@@ -109,9 +108,9 @@ export default class AbstractDialog<P : Props, S : State>
* @returns {void}
*/
_onSubmit(value: ?string) {
- const { okDisabled, onSubmit } = this.props;
+ const { okDisabled = false, onSubmit } = this.props;
- if (typeof okDisabled === 'undefined' || !okDisabled) {
+ if (!okDisabled) {
this.setState({ submitting: true });
// Invoke the React Compnent prop onSubmit if any.
diff --git a/react/features/base/react/components/web/Container.js b/react/features/base/react/components/web/Container.js
index 3f1face99b..721d4b7310 100644
--- a/react/features/base/react/components/web/Container.js
+++ b/react/features/base/react/components/web/Container.js
@@ -22,11 +22,8 @@ export default class Container extends AbstractContainer {
* @returns {ReactElement}
*/
render() {
- const { visible } = this.props;
+ const { visible = true } = this.props;
- return (
- typeof visible === 'undefined' || visible
- ? super._render('div')
- : null);
+ return visible ? super._render('div') : null;
}
}
diff --git a/react/features/calendar-sync/functions.native.js b/react/features/calendar-sync/functions.native.js
index a74e33c4eb..f2c743b558 100644
--- a/react/features/calendar-sync/functions.native.js
+++ b/react/features/calendar-sync/functions.native.js
@@ -19,9 +19,9 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);
* otherwise, {@code false}.
*/
export function isCalendarEnabled() {
- const { calendarEnabled } = NativeModules.AppInfo;
+ const { calendarEnabled = true } = NativeModules.AppInfo;
- return typeof calendarEnabled === 'undefined' ? true : calendarEnabled;
+ return calendarEnabled;
}
/**
diff --git a/react/features/subtitles/components/AbstractClosedCaptionButton.js b/react/features/subtitles/components/AbstractClosedCaptionButton.js
index 61d833e2c9..c76afeacd1 100644
--- a/react/features/subtitles/components/AbstractClosedCaptionButton.js
+++ b/react/features/subtitles/components/AbstractClosedCaptionButton.js
@@ -85,9 +85,6 @@ export class AbstractClosedCaptionButton
export function _abstractMapStateToProps(state: Object, ownProps: Object) {
const { _requestingSubtitles } = state['features/subtitles'];
const { transcribingEnabled } = state['features/base/config'];
-
- // Default 'visible' to 'transcribingEnabled' if not explicitly specified
- // in the component's properties.
const { visible = transcribingEnabled } = ownProps;
return {