mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-03 10:03:47 +00:00
* create constant for number of releases per os * sort releases * Apply suggestions from code review * change requests * fix build error * cleanup * fix: typo & prettier * refactor sort function * cleanup unnecessary changes * fix: getReleaseArch case * fix sort * prettier Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Co-authored-by: Nicolás Quiroz <nh.quiroz@gmail.com>
18 lines
545 B
TypeScript
18 lines
545 B
TypeScript
import { ReleaseData } from '../types';
|
|
|
|
export const compareReleasesFn = (a: ReleaseData, b: ReleaseData) => {
|
|
const aPublished = new Date(a.published);
|
|
const bPublished = new Date(b.published);
|
|
const sameDate = aPublished.toDateString() === bPublished.toDateString();
|
|
const sameCommit = a.commit.label === b.commit.label;
|
|
|
|
if (sameDate && !sameCommit) {
|
|
return aPublished > bPublished ? -1 : 1;
|
|
}
|
|
|
|
if (sameDate) {
|
|
return a.release.label.length - b.release.label.length;
|
|
}
|
|
|
|
return aPublished > bPublished ? -1 : 1;
|
|
};
|