mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-03-13 20:31:39 +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:
@@ -97,9 +97,8 @@ export async function parseIniFile(ini_file: string): Promise<string> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Async foreach loop
|
||||
* Async foreach loop using modern for...of pattern
|
||||
*
|
||||
* @author https://github.com/Atinux
|
||||
* @param array
|
||||
* @param callback
|
||||
*/
|
||||
@@ -111,8 +110,8 @@ export async function asyncForEach(
|
||||
array: Array<string>
|
||||
) => Promise<void>
|
||||
): Promise<void> {
|
||||
for (let index = 0; index < array.length; index++) {
|
||||
await callback(array[index], index, array);
|
||||
for (const [index, element] of array.entries()) {
|
||||
await callback(element, index, array);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user