mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-01-23 09:07:52 +07:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user