|
1 | 1 | 'use strict'; |
2 | 2 | const { |
| 3 | + ArrayPrototypeForEach, |
3 | 4 | ArrayPrototypeMap, |
4 | 5 | ArrayPrototypePush, |
5 | 6 | FunctionPrototypeBind, |
@@ -62,18 +63,22 @@ class WASI { |
62 | 63 | const env = []; |
63 | 64 | if (options.env !== undefined) { |
64 | 65 | validateObject(options.env, 'options.env'); |
65 | | - for (const [key, value] of ObjectEntries(options.env)) { |
66 | | - if (value !== undefined) |
67 | | - ArrayPrototypePush(env, `${key}=${value}`); |
68 | | - } |
| 66 | + ArrayPrototypeForEach( |
| 67 | + ObjectEntries(options.env), |
| 68 | + ({ 0: key, 1: value }) => { |
| 69 | + if (value !== undefined) |
| 70 | + ArrayPrototypePush(env, `${key}=${value}`); |
| 71 | + }); |
69 | 72 | } |
70 | 73 |
|
71 | 74 | const preopens = []; |
72 | 75 | if (options.preopens !== undefined) { |
73 | 76 | validateObject(options.preopens, 'options.preopens'); |
74 | | - for (const [key, value] of ObjectEntries(options.preopens)) { |
75 | | - ArrayPrototypePush(preopens, String(key), String(value)); |
76 | | - } |
| 77 | + ArrayPrototypeForEach( |
| 78 | + ObjectEntries(options.preopens), |
| 79 | + ({ 0: key, 1: value }) => |
| 80 | + ArrayPrototypePush(preopens, String(key), String(value)) |
| 81 | + ); |
77 | 82 | } |
78 | 83 |
|
79 | 84 | const { stdin = 0, stdout = 1, stderr = 2 } = options; |
|
0 commit comments