-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d43b143
commit fa2017e
Showing
1 changed file
with
11 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,23 @@ | ||
import { ApiSource, ApiPerson, ApiSubmitter } from '../models'; | ||
|
||
export class ApiComparators { | ||
comparePersons(a: ApiPerson, b: ApiPerson) { | ||
const val = a.indexName.localeCompare(b.indexName); | ||
if (val !== 0) { | ||
return val; | ||
} | ||
return a.string.localeCompare(b.string); | ||
comparePersons = (a: ApiPerson, b: ApiPerson) => { | ||
return this.compare(a.indexName, a.string, b.indexName, b.string); | ||
} | ||
|
||
compareSources(a: ApiSource, b: ApiSource) { | ||
const val = a.title.localeCompare(b.title); | ||
if (val !== 0) { | ||
return val; | ||
} | ||
return a.string.localeCompare(b.string); | ||
compareSources = (a: ApiSource, b: ApiSource) => { | ||
return this.compare(a.title, a.string, b.title, b.string); | ||
} | ||
|
||
compareSubmitters = (a: ApiSubmitter, b: ApiSubmitter) => { | ||
return this.compare(a.name, a.string, b.name, b.string); | ||
} | ||
|
||
compareSubmitters(a: ApiSubmitter, b: ApiSubmitter) { | ||
const val = a.name.localeCompare(b.name); | ||
compare = (a1: string, a2: string, b1: string, b2: string) => { | ||
const val = a1.localeCompare(b1); | ||
if (val !== 0) { | ||
return val; | ||
} | ||
return a.string.localeCompare(b.string); | ||
return a2.localeCompare(b2); | ||
} | ||
} |