Refactor to use ES2024+ features for Node 24

Use Set for O(1) redirect status code lookup in fetch.ts

Use at(-1) and Object.hasOwn() in tools.ts

Use for...of with entries() in utils.ts
This commit is contained in:
Shivam Mathur
2026-01-20 06:46:28 +05:30
parent f0e37f9e90
commit 871ff01b2b
4 changed files with 12 additions and 11 deletions

View File

@@ -140,7 +140,7 @@ export async function filterList(tools_list: string[]): Promise<string[]> {
case matches[0] == undefined:
break;
default:
composer = matches[matches.length - 1].replace(/v(\d\S*)/, '$1');
composer = matches.at(-1)!.replace(/v(\d\S*)/, '$1');
break;
}
tools_list.unshift(composer);
@@ -488,7 +488,7 @@ export async function getData(
const tool = parts[0];
const version = parts[1];
let data: RS;
if (Object.keys(json_objects).includes(tool)) {
if (Object.hasOwn(json_objects, tool)) {
data = json_objects[tool];
data['tool'] = tool;
} else {