lint(curly): consistent use of curly brackets in codebase (#3584)

This commit is contained in:
Alireza authored and GitHub committed 2023-08-09 10:07:33 -04:00
1 parent 9ae3d9f769
commit 5d435424e2
113 files changed
+1501 -1056

No files matched your search

+3 -1
View File
@@ -1,7 +1,9 @@
const absoluteUrl = path => {
let absolutePath = '/';
if (!path) return absolutePath;
if (!path) {
return absolutePath;
}
// TODO: Find another way to get root url
const absoluteUrl = window.location.origin;
+6 -2
View File
@@ -9,12 +9,16 @@ function debounce(func, wait, immediate) {
args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
if (!immediate) {
func.apply(context, args);
}
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
if (callNow) {
func.apply(context, args);
}
};
}
+3 -1
View File
@@ -58,6 +58,8 @@ const imagesTypes = [
* @returns {boolean} - true if it has image data
*/
export const isImage = SOPClassUID => {
if (!SOPClassUID) return false;
if (!SOPClassUID) {
return false;
}
return imagesTypes.indexOf(SOPClassUID) !== -1;
};
@@ -1,4 +1,10 @@
const LOW_PRIORITY_MODALITIES = Object.freeze(['SEG', 'KO', 'PR', 'SR', 'RTSTRUCT']);
const LOW_PRIORITY_MODALITIES = Object.freeze([
'SEG',
'KO',
'PR',
'SR',
'RTSTRUCT',
]);
export default function isLowPriorityModality(Modality) {
return LOW_PRIORITY_MODALITIES.includes(Modality);
+6 -2
View File
@@ -2,11 +2,15 @@ export default function makeCancelable(thenable) {
let isCanceled = false;
const promise = Promise.resolve(thenable).then(
function(result) {
if (isCanceled) throw Object.freeze({ isCanceled });
if (isCanceled) {
throw Object.freeze({ isCanceled });
}
return result;
},
function(error) {
if (isCanceled) throw Object.freeze({ isCanceled, error });
if (isCanceled) {
throw Object.freeze({ isCanceled, error });
}
throw error;
}
);
@@ -18,8 +18,9 @@ export default function fetchPaletteColorLookupTableData(
) {
const { PaletteColorLookupTableUID } = item;
const paletteData = item[tag];
if (paletteData === undefined && PaletteColorLookupTableUID === undefined)
if (paletteData === undefined && PaletteColorLookupTableUID === undefined) {
return;
}
// performance optimization - read UID and cache by UID
return _getPaletteColor(item[tag], item[descriptorTag]);
}
@@ -28,7 +29,9 @@ function _getPaletteColor(paletteColorLookupTableData, lutDescriptor) {
const numLutEntries = lutDescriptor[0];
const bits = lutDescriptor[2];
if (!paletteColorLookupTableData) return undefined;
if (!paletteColorLookupTableData) {
return undefined;
}
const arrayBufferToPaletteColorLUT = arraybuffer => {
const lut = [];
@@ -124,7 +124,9 @@ function getOverallProgress(list) {
status.total++;
if (isValidProgress(task.progress)) {
status.partial += task.progress;
if (task.progress === 1.0 && task.failed) status.failures++;
if (task.progress === 1.0 && task.failed) {
status.failures++;
}
}
task = task.next;
}
+8 -3
View File
@@ -13,7 +13,9 @@ const compareSeriesDateTime = (a, b) => {
const defaultSeriesSort = (a, b) => {
const seriesNumberA = a.SeriesNumber ?? a.seriesNumber;
const seriesNumberB = b.SeriesNumber ?? b.seriesNumber;
if (seriesNumberA === seriesNumberB) return compareSeriesDateTime(a, b);
if (seriesNumberA === seriesNumberB) {
return compareSeriesDateTime(a, b);
}
return seriesNumberA - seriesNumberB;
};
@@ -67,8 +69,11 @@ const sortStudySeries = (
seriesSortingCriteria = seriesSortCriteria.default,
sortFunction = null
) => {
if (typeof sortFunction === 'function') return sortFunction(series);
else return series.sort(seriesSortingCriteria);
if (typeof sortFunction === 'function') {
return sortFunction(series);
} else {
return series.sort(seriesSortingCriteria);
}
};
/**
+6 -2
View File
@@ -1,6 +1,8 @@
/** Splits a list of stirngs by commas within the strings */
const splitComma = (strings: string[]): string[] => {
if (!strings) return null;
if (!strings) {
return null;
}
for (let i = 0; i < strings.length; i++) {
const comma = strings[i].indexOf(',');
if (comma !== -1) {
@@ -24,7 +26,9 @@ const getSplitParam = (
const sourceKey = [...params.keys()].find(
it => it.toLowerCase() === lowerCaseKey
);
if (!sourceKey) return;
if (!sourceKey) {
return;
}
return splitComma(params.getAll(sourceKey));
};