Skip to content

Commit ee0991a

Browse files
committed
feat: output item in hashes list
1 parent e42b296 commit ee0991a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/hashes.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,18 @@ HASHES_ROUTER.get("/", async (c) => {
2121
// fetch all hashes
2222
const hashes = await Promise.all(keys.map(async (key) => {
2323
const hash = await c.env.MOJIS_HASHES.get(key);
24+
25+
if (hash == null) return null;
26+
27+
const [version, item] = key.split(":");
2428
return {
25-
version: key.split(":")[1],
29+
version,
2630
hash,
31+
item,
2732
};
2833
}));
2934

30-
return c.json(hashes);
35+
return c.json(hashes.filter((h) => h != null));
3136
});
3237

3338
HASHES_ROUTER.get("/:version", async (c) => {

0 commit comments

Comments
 (0)