Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Increase the usage of compound assignment operators #2118

Open
elfring opened this issue Dec 11, 2021 · 0 comments
Open

Increase the usage of compound assignment operators #2118

elfring opened this issue Dec 11, 2021 · 0 comments

Comments

@elfring
Copy link

elfring commented Dec 11, 2021

👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of compound operators accordingly.

diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js
index 1023d3ec..20eb2a5b 100755
--- a/app/js/lib/ng_utils.js
+++ b/app/js/lib/ng_utils.js
@@ -54,8 +54,8 @@ angular.module('izhukov.utils', [])
   })
 
   .service('FileManager', function ($window, $q, $timeout, qSync) {
-    $window.URL = $window.URL || $window.webkitURL
-    $window.BlobBuilder = $window.BlobBuilder || $window.WebKitBlobBuilder || $window.MozBlobBuilder
+    $window.URL ||= $window.webkitURL
+    $window.BlobBuilder ||= $window.WebKitBlobBuilder || $window.MozBlobBuilder
     var isSafari = 'safari' in window
     var safariVersion = parseFloat(isSafari && (navigator.userAgent.match(/Version\/(\d+\.\d+).* Safari/) || [])[1])
     var safariWithDownload = isSafari && safariVersion >= 11.0
@@ -345,8 +345,8 @@ angular.module('izhukov.utils', [])
   })
 
   .service('IdbFileStorage', function ($q, $window, FileManager) {
-    $window.indexedDB = $window.indexedDB || $window.webkitIndexedDB || $window.mozIndexedDB || $window.OIndexedDB || $window.msIndexedDB
-    $window.IDBTransaction = $window.IDBTransaction || $window.webkitIDBTransaction || $window.OIDBTransaction || $window.msIDBTransaction
+    $window.indexedDB ||= $window.webkitIndexedDB || $window.mozIndexedDB || $window.OIndexedDB || $window.msIndexedDB
+    $window.IDBTransaction ||= $window.webkitIDBTransaction || $window.OIDBTransaction || $window.msIDBTransaction
 
     var dbName = 'cachedFiles'
     var dbStoreName = 'files'
@@ -580,7 +580,7 @@ angular.module('izhukov.utils', [])
   })
 
   .service('TmpfsFileStorage', function ($q, $window, FileManager) {
-    $window.requestFileSystem = $window.requestFileSystem || $window.webkitRequestFileSystem
+    $window.requestFileSystem ||= $window.webkitRequestFileSystem
 
     var reqFsPromise,
       fileSystem
diff --git a/app/vendor/angular/angular.js b/app/vendor/angular/angular.js
index fdfcdfd8..f24a63b2 100644
--- a/app/vendor/angular/angular.js
+++ b/app/vendor/angular/angular.js
@@ -8556,8 +8556,8 @@ function $TemplateCacheProvider() {
  *     <div>
  *       This is equivalent to `ngClick` and `ngMouseover`:<br>
  *       <button
- *         ng-on-click="$ctrl.clickCount = $ctrl.clickCount + 1"
- *         ng-on-mouseover="$ctrl.mouseoverCount = $ctrl.mouseoverCount + 1">Click or mouseover</button><br>
+ *         ng-on-click="$ctrl.clickCount += 1"
+ *         ng-on-mouseover="$ctrl.mouseoverCount += 1">Click or mouseover</button><br>
  *       clickCount: {{$ctrl.clickCount}}<br>
  *       mouseover: {{$ctrl.mouseoverCount}}
  *
@@ -14119,8 +14119,8 @@ function $IntervalProvider() {
      *
      *             stop = $interval(function() {
      *               if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {
-     *                 $scope.blood_1 = $scope.blood_1 - 3;
-     *                 $scope.blood_2 = $scope.blood_2 - 4;
+     *                 $scope.blood_1 -= 3;
+     *                 $scope.blood_2 -= 4;
      *               } else {
      *                 $scope.stopFight();
      *               }
diff --git a/app/vendor/bootstrap/js/bootstrap.js b/app/vendor/bootstrap/js/bootstrap.js
index 4dd3073e..ffc042e7 100755
--- a/app/vendor/bootstrap/js/bootstrap.js
+++ b/app/vendor/bootstrap/js/bootstrap.js
@@ -1188,7 +1188,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap's JavaScript req
   }
 
   Tooltip.prototype.getPosition = function ($element) {
-    $element   = $element || this.$element
+    $element ||= this.$element
     var el     = $element[0]
     var isBody = el.tagName == 'BODY'
     return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant