@stamhoofd/structures
Advanced tools
Comparing version 1.1.7 to 1.1.8
@@ -6,4 +6,6 @@ import { AutoEncoder } from '@simonbackx/simple-encoding'; | ||
settings: GroupSettings; | ||
static defaultSort(a: Group, b: Group): 0 | 1 | -1; | ||
static nameSort(a: Group, b: Group): 0 | 1 | -1; | ||
} | ||
export declare const GroupPatch: typeof AutoEncoder & (new () => import("@simonbackx/simple-encoding").AutoEncoderPatchType<Group>); | ||
//# sourceMappingURL=Group.d.ts.map |
@@ -9,2 +9,30 @@ "use strict"; | ||
class Group extends simple_encoding_1.AutoEncoder { | ||
static defaultSort(a, b) { | ||
if (a.settings.minBirthYear && !b.settings.minBirthYear) { | ||
return 1; | ||
} | ||
if (b.settings.minBirthYear && !a.settings.minBirthYear) { | ||
return -1; | ||
} | ||
if (!b.settings.minBirthYear && !a.settings.minBirthYear) { | ||
// name | ||
return this.nameSort(a, b); | ||
} | ||
if (a.settings.minBirthYear > b.settings.minBirthYear) { | ||
return 1; | ||
} | ||
if (a.settings.minBirthYear < b.settings.minBirthYear) { | ||
return -1; | ||
} | ||
return this.nameSort(a, b); | ||
} | ||
static nameSort(a, b) { | ||
if (a.settings.name.toLowerCase() < b.settings.name.toLowerCase()) { | ||
return 1; | ||
} | ||
if (a.settings.name.toLowerCase() > b.settings.name.toLowerCase()) { | ||
return -1; | ||
} | ||
return 0; | ||
} | ||
} | ||
@@ -11,0 +39,0 @@ tslib_1.__decorate([ |
@@ -6,4 +6,6 @@ import { AutoEncoder } from '@simonbackx/simple-encoding'; | ||
settings: GroupSettings; | ||
static defaultSort(a: Group, b: Group): 0 | 1 | -1; | ||
static nameSort(a: Group, b: Group): 0 | 1 | -1; | ||
} | ||
export declare const GroupPatch: typeof AutoEncoder & (new () => import("@simonbackx/simple-encoding").AutoEncoderPatchType<Group>); | ||
//# sourceMappingURL=Group.d.ts.map |
@@ -6,2 +6,30 @@ import { __decorate } from "tslib"; | ||
export class Group extends AutoEncoder { | ||
static defaultSort(a, b) { | ||
if (a.settings.minBirthYear && !b.settings.minBirthYear) { | ||
return 1; | ||
} | ||
if (b.settings.minBirthYear && !a.settings.minBirthYear) { | ||
return -1; | ||
} | ||
if (!b.settings.minBirthYear && !a.settings.minBirthYear) { | ||
// name | ||
return this.nameSort(a, b); | ||
} | ||
if (a.settings.minBirthYear > b.settings.minBirthYear) { | ||
return 1; | ||
} | ||
if (a.settings.minBirthYear < b.settings.minBirthYear) { | ||
return -1; | ||
} | ||
return this.nameSort(a, b); | ||
} | ||
static nameSort(a, b) { | ||
if (a.settings.name.toLowerCase() < b.settings.name.toLowerCase()) { | ||
return 1; | ||
} | ||
if (a.settings.name.toLowerCase() > b.settings.name.toLowerCase()) { | ||
return -1; | ||
} | ||
return 0; | ||
} | ||
} | ||
@@ -8,0 +36,0 @@ __decorate([ |
{ | ||
"name": "@stamhoofd/structures", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./esm/dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
144760
2080