Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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
}

0 commit comments

Comments
 (0)