diff --git a/js/misc/jsParse.js b/js/misc/jsParse.js index 5adc2d654..464e6bf8b 100644 --- a/js/misc/jsParse.js +++ b/js/misc/jsParse.js @@ -151,11 +151,7 @@ function getAllProps(obj) { // e.g., expr="({ foo: null, bar: null, 4: null })" will // return ["foo", "bar", ...] but the list will not include "4", // since methods accessed with '.' notation must star with a letter or _. -function getPropertyNamesFromExpression(expr, commandHeader) { - if (commandHeader == null) { - commandHeader = ''; - } - +function getPropertyNamesFromExpression(expr, commandHeader = '') { let obj = {}; if (!isUnsafeExpression(expr)) { try { diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index ff771d302..60322f81a 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -1416,7 +1416,7 @@ var AppFolderPopup = class AppFolderPopup { Signals.addSignalMethods(AppFolderPopup.prototype); var AppIcon = class AppIcon { - constructor(app, iconParams) { + constructor(app, iconParams = {}) { this.app = app; this.id = app.get_id(); this.name = app.get_name(); @@ -1442,9 +1442,6 @@ var AppIcon = class AppIcon { this.actor._delegate = this; - if (!iconParams) - iconParams = {}; - // Get the isDraggable property without passing it on to the BaseIcon: let appIconParams = Params.parse(iconParams, { isDraggable: true }, true); let isDraggable = appIconParams['isDraggable']; diff --git a/js/ui/barLevel.js b/js/ui/barLevel.js index fe49b945d..b0e16d916 100644 --- a/js/ui/barLevel.js +++ b/js/ui/barLevel.js @@ -4,7 +4,7 @@ const { Atk, Clutter, St } = imports.gi; const Signals = imports.signals; var BarLevel = class { - constructor(value, params) { + constructor(value, params = {}) { if (isNaN(value)) // Avoid spreading NaNs around throw TypeError('The bar level value must be a number'); @@ -13,9 +13,6 @@ var BarLevel = class { this._overdriveStart = 1; this._barLevelWidth = 0; - if (params == undefined) - params = {}; - this.actor = new St.DrawingArea({ styleClass: params['styleClass'] || 'barlevel', can_focus: params['canFocus'] || false, reactive: params['reactive'] || false, diff --git a/js/ui/components/autorunManager.js b/js/ui/components/autorunManager.js index 313edc9a8..6d8790131 100644 --- a/js/ui/components/autorunManager.js +++ b/js/ui/components/autorunManager.js @@ -122,10 +122,7 @@ var ContentTypeDiscoverer = class { } } - _emitCallback(mount, contentTypes) { - if (!contentTypes) - contentTypes = []; - + _emitCallback(mount, contentTypes = []) { // we're not interested in win32 software content types here contentTypes = contentTypes.filter( type => (type != 'x-content/win32-software') diff --git a/js/ui/layout.js b/js/ui/layout.js index dafcf8fb4..66ea05dfe 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -841,7 +841,7 @@ var LayoutManager = GObject.registerClass({ // @params can have any of the same values as in addChrome(), // though some possibilities don't make sense. By default, @actor has // the same params as its chrome ancestor. - trackChrome(actor, params) { + trackChrome(actor, params = {}) { let ancestor = actor.get_parent(); let index = this._findActor(ancestor); while (ancestor && index == -1) { @@ -851,8 +851,6 @@ var LayoutManager = GObject.registerClass({ let ancestorData = ancestor ? this._trackedActors[index] : defaultParams; - if (!params) - params = {}; // We can't use Params.parse here because we want to drop // the extra values like ancestorData.actor for (let prop in defaultParams) { diff --git a/js/ui/messageList.js b/js/ui/messageList.js index 5f7a0865c..c8f4b9346 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -33,9 +33,7 @@ function _fixMarkup(text, allowMarkup) { } var URLHighlighter = class URLHighlighter { - constructor(text, lineWrap, allowMarkup) { - if (!text) - text = ''; + constructor(text = '', lineWrap, allowMarkup) { this.actor = new St.Label({ reactive: true, style_class: 'url-highlighter', x_expand: true, x_align: Clutter.ActorAlign.START }); this._linkColor = '#ccccff'; diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 4a0a974b0..f8c6c79e7 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -473,9 +473,7 @@ var Notification = class Notification { this.destroy(); } - destroy(reason) { - if (!reason) - reason = NotificationDestroyedReason.DISMISSED; + destroy(reason = NotificationDestroyedReason.DISMISSED) { this.emit('destroy', reason); } }; diff --git a/js/ui/osdWindow.js b/js/ui/osdWindow.js index 3730d6b20..2895ab5f3 100644 --- a/js/ui/osdWindow.js +++ b/js/ui/osdWindow.js @@ -151,9 +151,7 @@ var OsdWindow = class { } } - setMaxLevel(maxLevel) { - if (maxLevel === undefined) - maxLevel = 100; + setMaxLevel(maxLevel = 100) { this._level.maxLevel = maxLevel; } diff --git a/js/ui/panel.js b/js/ui/panel.js index 6b8e60b19..e36bf4c35 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -706,9 +706,7 @@ var PanelCorner = class { var AggregateLayout = GObject.registerClass( class AggregateLayout extends Clutter.BoxLayout { - _init(params) { - if (!params) - params = {}; + _init(params = {}) { params['orientation'] = Clutter.Orientation.VERTICAL; super._init(params);