refactor: convert logical operator to optional chainining

The [optional chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) operator can be used to perform null checks before accessing a property, or calling a function.
pull/527/head^2
deepsource-autofix[bot] 2024-01-01 11:20:20 +00:00 committed by GitHub
parent b69ab5f577
commit 219c9d7133
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -56,7 +56,7 @@
return result;
function _iterateSubItems(currentItem) {
currentItem.subMenu && currentItem.subMenu.forEach(function(subItem) {
currentItem.subMenu?.forEach(function(subItem) {
subItem.stateRef && result.push(subItem.stateRef);
_iterateSubItems(subItem);
});

View File

@ -57,7 +57,7 @@
function BaSidebarTogglingItemCtrl($scope, $element, $attrs, $state, baSidebarService) {
var vm = this;
var menuItem = vm.$$menuItem = $scope.$eval($attrs.baSidebarTogglingItem);
if (menuItem && menuItem.subMenu && menuItem.subMenu.length) {
if (menuItem?.subMenu && menuItem.subMenu.length) {
vm.$$expandSubmenu = function() { console.warn('$$expandMenu should be overwritten by baUiSrefTogglingSubmenu') };
vm.$$collapseSubmenu = function() { console.warn('$$collapseSubmenu should be overwritten by baUiSrefTogglingSubmenu') };

View File

@ -38,7 +38,7 @@
}
function submit() {
$scope.form && $scope.form.$setSubmitted(true);
$scope.form?.$setSubmitted(true);
}
function isComplete() {