Skip to content

Commit c49f950

Browse files
fix(lint): adhere to strict triple equality check (#477)
1 parent 9be8fbf commit c49f950

22 files changed

+27
-26
lines changed

src/app/examples/custom-angularComponentEditor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class CustomAngularComponentEditor implements Editor {
161161
}
162162

163163
isValueChanged() {
164-
return (!(this.componentRef.instance.selectedId === '' && this.defaultId == null)) && (this.componentRef.instance.selectedId !== this.defaultId);
164+
return (!(this.componentRef.instance.selectedId === '' && (this.defaultId === null || this.defaultId === undefined))) && (this.componentRef.instance.selectedId !== this.defaultId);
165165
}
166166

167167
validate(): EditorValidatorOutput {

src/app/examples/grid-editor.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const myCustomTitleValidator: EditorValidator = (value: any, args: EditorArgs) =
4141
// don't use "editor" property since that one is what SlickGrid uses internally by it's editor factory
4242
const columnEditor = args && args.column && args.column.internalColumnEditor;
4343

44-
if (value == null || value === undefined || !value.length) {
44+
if (value === null || value === undefined || !value.length) {
4545
return { valid: false, msg: 'This is a required field' };
4646
} else if (!/^Task\s\d+$/.test(value)) {
4747
return { valid: false, msg: 'Your title is invalid, it must start with "Task" followed by a number' };
@@ -644,6 +644,7 @@ export class GridEditorComponent implements OnInit {
644644

645645
undo() {
646646
const command = this._commandQueue.pop();
647+
const item = this.angularGrid.dataView.getItem(command.row);
647648
if (command && Slick.GlobalEditorLock.cancelCurrentEdit()) {
648649
command.undo();
649650
this.gridObj.gotoCell(command.row, command.cell, false);

src/app/modules/angular-slickgrid/aggregators/avgAggregator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class AvgAggregator implements Aggregator {
1919
accumulate(item: any) {
2020
const val = (item && item.hasOwnProperty(this._field)) ? item[this._field] : null;
2121
this._count++;
22-
if (val != null && val !== '' && !isNaN(val)) {
22+
if (val !== null && val !== undefined && val !== '' && !isNaN(val)) {
2323
this._nonNullCount++;
2424
this._sum += parseFloat(val);
2525
}

src/app/modules/angular-slickgrid/aggregators/maxAggregator.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export class MaxAggregator implements Aggregator {
1414

1515
accumulate(item: any) {
1616
const val = (item && item.hasOwnProperty(this._field)) ? item[this._field] : null;
17-
if (val != null && val !== '' && !isNaN(val)) {
18-
if (this._max == null || val > this._max) {
17+
if (val !== null && val !== undefined && val !== '' && !isNaN(val)) {
18+
if (this._max === null || this._max === undefined || val > this._max) {
1919
this._max = parseFloat(val);
2020
}
2121
}

src/app/modules/angular-slickgrid/aggregators/minAggregator.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export class MinAggregator implements Aggregator {
1414

1515
accumulate(item: any) {
1616
const val = (item && item.hasOwnProperty(this._field)) ? item[this._field] : null;
17-
if (val != null && val !== '' && !isNaN(val)) {
18-
if (this._min == null || val < this._min) {
17+
if (val !== null && val !== undefined && val !== '' && !isNaN(val)) {
18+
if (this._min === null || this._min === undefined || val < this._min) {
1919
this._min = parseFloat(val);
2020
}
2121
}

src/app/modules/angular-slickgrid/aggregators/sumAggregator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class SumAggregator implements Aggregator {
1414

1515
accumulate(item: any) {
1616
const val = (item && item.hasOwnProperty(this._field)) ? item[this._field] : null;
17-
if (val != null && val !== '' && !isNaN(val)) {
17+
if (val !== null && val !== undefined && val !== '' && !isNaN(val)) {
1818
this._sum += parseFloat(val);
1919
}
2020
}

src/app/modules/angular-slickgrid/grouping-formatters/avgTotalsDollarFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const avgTotalsDollarFormatter: GroupTotalsFormatter = (totals: any, colu
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
const formattedNumber = formatNumber(val, minDecimal, maxDecimal, displayNegativeNumberWithParentheses, '$', '', decimalSeparator, thousandSeparator);
1919
return `${prefix}${formattedNumber}${suffix}`;
2020
}

src/app/modules/angular-slickgrid/grouping-formatters/avgTotalsFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const avgTotalsFormatter: GroupTotalsFormatter = (totals: any, columnDef:
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
if (val < 0) {
1919
val = Math.abs(val);
2020
if (!displayNegativeNumberWithParentheses) {

src/app/modules/angular-slickgrid/grouping-formatters/avgTotalsPercentageFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const avgTotalsPercentageFormatter: GroupTotalsFormatter = (totals: any,
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
if (val < 0) {
1919
val = Math.abs(val);
2020
if (!displayNegativeNumberWithParentheses) {

src/app/modules/angular-slickgrid/grouping-formatters/maxTotalsFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const maxTotalsFormatter: GroupTotalsFormatter = (totals: any, columnDef:
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
const formattedNumber = formatNumber(val, minDecimal, maxDecimal, displayNegativeNumberWithParentheses, '', '', decimalSeparator, thousandSeparator);
1919
return `${prefix}${formattedNumber}${suffix}`;
2020
}

src/app/modules/angular-slickgrid/grouping-formatters/minTotalsFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const minTotalsFormatter: GroupTotalsFormatter = (totals: any, columnDef:
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
const formattedNumber = formatNumber(val, minDecimal, maxDecimal, displayNegativeNumberWithParentheses, '', '', decimalSeparator, thousandSeparator);
1919
return `${prefix}${formattedNumber}${suffix}`;
2020
}

src/app/modules/angular-slickgrid/grouping-formatters/sumTotalsBoldFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const sumTotalsBoldFormatter: GroupTotalsFormatter = (totals: any, column
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
const formattedNumber = formatNumber(val, minDecimal, maxDecimal, displayNegativeNumberWithParentheses, '', '', decimalSeparator, thousandSeparator);
1919
return `<b>${prefix}${formattedNumber}${suffix}</b>`;
2020
}

src/app/modules/angular-slickgrid/grouping-formatters/sumTotalsColoredFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const sumTotalsColoredFormatter: GroupTotalsFormatter = (totals: any, col
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
const colorStyle = (val >= 0) ? 'green' : 'red';
1919
const formattedNumber = formatNumber(val, minDecimal, maxDecimal, displayNegativeNumberWithParentheses, '', '', decimalSeparator, thousandSeparator);
2020
return `<span style="color:${colorStyle}">${prefix}${formattedNumber}${suffix}</span>`;

src/app/modules/angular-slickgrid/grouping-formatters/sumTotalsDollarBoldFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const sumTotalsDollarBoldFormatter: GroupTotalsFormatter = (totals: any,
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
const formattedNumber = formatNumber(val, minDecimal, maxDecimal, displayNegativeNumberWithParentheses, '$', '', decimalSeparator, thousandSeparator);
1919
return `<b>${prefix}${formattedNumber}${suffix}</b>`;
2020
}

src/app/modules/angular-slickgrid/grouping-formatters/sumTotalsDollarColoredBoldFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const sumTotalsDollarColoredBoldFormatter: GroupTotalsFormatter = (totals
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
const colorStyle = (val >= 0) ? 'green' : 'red';
1919
const formattedNumber = formatNumber(val, minDecimal, maxDecimal, displayNegativeNumberWithParentheses, '$', '', decimalSeparator, thousandSeparator);
2020
return `<span style="color:${colorStyle}; font-weight: bold;">${prefix}${formattedNumber}${suffix}</span>`;

src/app/modules/angular-slickgrid/grouping-formatters/sumTotalsDollarColoredFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const sumTotalsDollarColoredFormatter: GroupTotalsFormatter = (totals: an
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
const colorStyle = (val >= 0) ? 'green' : 'red';
1919
const formattedNumber = formatNumber(val, minDecimal, maxDecimal, displayNegativeNumberWithParentheses, '$', '', decimalSeparator, thousandSeparator);
2020
return `<span style="color:${colorStyle}">${prefix}${formattedNumber}${suffix}</span>`;

src/app/modules/angular-slickgrid/grouping-formatters/sumTotalsDollarFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const sumTotalsDollarFormatter: GroupTotalsFormatter = (totals: any, colu
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
const formattedNumber = formatNumber(val, minDecimal, maxDecimal, displayNegativeNumberWithParentheses, '$', '', decimalSeparator, thousandSeparator);
1919
return `${prefix}${formattedNumber}${suffix}`;
2020
}

src/app/modules/angular-slickgrid/grouping-formatters/sumTotalsFormatter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const sumTotalsFormatter: GroupTotalsFormatter = (totals: any, columnDef:
1414
const thousandSeparator = getValueFromParamsOrFormatterOptions('thousandSeparator', columnDef, grid, '');
1515
const displayNegativeNumberWithParentheses = getValueFromParamsOrFormatterOptions('displayNegativeNumberWithParentheses', columnDef, grid, false);
1616

17-
if (val != null && !isNaN(+val)) {
17+
if (val !== null && val !== undefined && !isNaN(+val)) {
1818
const formattedNumber = formatNumber(val, minDecimal, maxDecimal, displayNegativeNumberWithParentheses, '', '', decimalSeparator, thousandSeparator);
1919
return `${prefix}${formattedNumber}${suffix}`;
2020
}

src/app/modules/angular-slickgrid/services/__tests__/excelExport.service.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const myUppercaseFormatter: Formatter = (row, cell, value, columnDef, dataContex
2525
const myUppercaseGroupTotalFormatter: GroupTotalsFormatter = (totals: any, columnDef: Column) => {
2626
const field = columnDef.field || '';
2727
const val = totals.sum && totals.sum[field];
28-
if (val != null && !isNaN(+val)) {
28+
if (val !== null && val !== undefined && !isNaN(+val)) {
2929
return `Custom: ${val}`;
3030
}
3131
return '';

src/app/modules/angular-slickgrid/services/excelExport.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,9 @@ export class ExcelExportService {
446446
// loop through all the grid rows of data
447447
for (let rowNumber = 0; rowNumber < lineCount; rowNumber++) {
448448
const itemObj = this._dataView.getItem(rowNumber);
449-
if (itemObj != null) {
449+
if (itemObj) {
450450
// Normal row (not grouped by anything) would have an ID which was predefined in the Grid Columns definition
451-
if (itemObj[this.datasetIdName] != null) {
451+
if (itemObj[this.datasetIdName] !== null && itemObj[this.datasetIdName] !== undefined) {
452452
// get regular row item data
453453
originalDaraArray.push(this.readRegularRowData(columns, rowNumber, itemObj));
454454
} else if (this._hasGroupedItems && itemObj.__groupTotals === undefined) {

src/app/modules/angular-slickgrid/services/export.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ export class ExportService {
229229
// loop through all the grid rows of data
230230
for (let rowNumber = 0; rowNumber < lineCount; rowNumber++) {
231231
const itemObj = this._dataView.getItem(rowNumber);
232-
if (itemObj != null) {
232+
if (itemObj) {
233233
// Normal row (not grouped by anything) would have an ID which was predefined in the Grid Columns definition
234-
if (itemObj[this.datasetIdName] != null) {
234+
if (itemObj[this.datasetIdName] !== null && itemObj[this.datasetIdName] !== undefined) {
235235
// get regular row item data
236236
outputDataStrings.push(this.readRegularRowData(columns, rowNumber, itemObj));
237237
} else if (this._hasGroupedItems && itemObj.__groupTotals === undefined) {

src/assets/lib/multiple-select/multiple-select.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@
403403
}).off('keyup').on('keyup', function (e) {
404404
// enter or space
405405
// Avoid selecting/deselecting if no choices made
406-
if (that.options.filterAcceptOnEnter && (e.which === 13 || e.which == 32) && that.$searchInput.val()) {
406+
if (that.options.filterAcceptOnEnter && (e.which === 13 || e.which === 32) && that.$searchInput.val()) {
407407
that.$selectAll.click();
408408
that.close();
409409
that.focus();

0 commit comments

Comments
 (0)