Skip to content

Commit 8761519

Browse files
committed
fix: remove distinctBy/sortBy
1 parent 1286b31 commit 8761519

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/index.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import { UnityChangeset } from "./unityChangeset.ts";
2-
import {
3-
distinctBy,
4-
sortBy,
5-
} from "https://deno.land/std@0.180.0/collections/mod.ts";
62

73
const REGEXP_HUB_LINKS = /unityhub:\/\/\d{4}\.\d+\.\d+(a|b|f)\d+\/\w{12}/g;
84
const UNITY_ARCHIVE_URL = "https://unity3d.com/get-unity/download/archive";
@@ -46,10 +42,13 @@ export async function scrapeArchivedChangesets(): Promise<UnityChangeset[]> {
4642
const changesets = (await getUnityChangesetsFromUrl(UNITY_ARCHIVE_URL))
4743
.concat(await getUnityChangesetsFromUrl(UNITY_RSS_URL));
4844

49-
return sortBy(
50-
distinctBy(changesets, (c) => c.versionNumber),
51-
(c) => -c.versionNumber,
52-
);
45+
const unique = new Set();
46+
return changesets.filter((c) => {
47+
const duplicated = unique.has(c.versionNumber);
48+
unique.add(c.versionNumber);
49+
return !duplicated;
50+
})
51+
.sort((a, b) => b.versionNumber - a.versionNumber);
5352
}
5453

5554
/*

0 commit comments

Comments
 (0)