Add prefer optional chaining rule
This commit is contained in:
@@ -93,7 +93,7 @@ function onListItemClick(e) {
|
||||
|
||||
if (listItem) {
|
||||
const index = parseInt(listItem.getAttribute('data-index'), 10);
|
||||
const pathInfos = (currentOptions.library.LibraryOptions || {}).PathInfos || [];
|
||||
const pathInfos = currentOptions.library.LibraryOptions?.PathInfos || [];
|
||||
const pathInfo = index == null ? {} : pathInfos[index] || {};
|
||||
const originalPath = pathInfo.Path || (index == null ? null : currentOptions.library.Locations[index]);
|
||||
const btnRemovePath = dom.parentWithClass(e.target, 'btnRemovePath');
|
||||
@@ -139,7 +139,7 @@ function refreshLibraryFromServer(page) {
|
||||
}
|
||||
|
||||
function renderLibrary(page, options) {
|
||||
let pathInfos = (options.library.LibraryOptions || {}).PathInfos || [];
|
||||
let pathInfos = options.library.LibraryOptions?.PathInfos || [];
|
||||
|
||||
if (!pathInfos.length) {
|
||||
pathInfos = options.library.Locations.map(p => {
|
||||
|
||||
Reference in New Issue
Block a user