Skip to content

Commit be0b579

Browse files
committed
fix: use compareNullOrUndefined from utilities
1 parent e940046 commit be0b579

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

source/processors/sorter-processor/sorter-processor.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ArrayProcessor } from '../array-processor';
22
import type { ArrayProcessorApi } from '../array-processor';
33
import { SorterDirection } from './sorter-direction';
44
import {
5+
compareNullOrUndefined,
56
compareNumbers,
67
isBoolean, isFunction, isVoid
78
} from '@colonise/utilities';
@@ -156,7 +157,7 @@ export class SorterProcessor<TEntry> extends ArrayProcessor<TEntry> implements S
156157
protected propertySorterToFunctionSorter(property: PropertySorter<TEntry>): FunctionSorter<TEntry> {
157158
return (entryA: TEntry, entryB: TEntry) => {
158159
if (entryA === undefined || entryA === null || entryB === undefined || entryB === null) {
159-
return this.compareNullOrUndefined(entryA, entryB);
160+
return compareNullOrUndefined(entryA, entryB);
160161
}
161162

162163
return this.compare(entryA[property], entryB[property]);
@@ -211,17 +212,4 @@ export class SorterProcessor<TEntry> extends ArrayProcessor<TEntry> implements S
211212

212213
return 0;
213214
}
214-
215-
// eslint-disable-next-line @typescript-eslint/ban-types
216-
private compareNullOrUndefined(entryA: TEntry | null | undefined, entryB: TEntry | null | undefined): number {
217-
if ((entryA === undefined || entryA === null) && (entryB !== undefined && entryB !== null)) {
218-
return 1;
219-
}
220-
221-
if ((entryA !== undefined && entryA !== null) && (entryB === undefined || entryB === null)) {
222-
return -1;
223-
}
224-
225-
return 0;
226-
}
227215
}

0 commit comments

Comments
 (0)