GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — wasi: improve use of primordials · nodejs/node@bdaac04

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • wasi.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/wasi.js‎

Copy file name to clipboardExpand all lines: lib/wasi.js
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
/* global WebAssembly */
33
const {
44
ArrayIsArray,
5-
ArrayPrototypeForEach,
65
ArrayPrototypeMap,
6+
ArrayPrototypePush,
77
FunctionPrototypeBind,
8-
ObjectKeys,
8+
ObjectEntries,
99
Symbol,
1010
} = primordials;
1111

@@ -40,7 +40,7 @@ class WASI {
4040
for (const key in env) {
4141
const value = env[key];
4242
if (value !== undefined)
43-
envPairs.push(`${key}=${value}`);
43+
ArrayPrototypePush(envPairs, `${key}=${value}`);
4444
}
4545
} else if (env !== undefined) {
4646
throw new ERR_INVALID_ARG_TYPE('options.env', 'Object', env);
@@ -49,10 +49,9 @@ class WASI {
4949
const preopenArray = [];
5050

5151
if (typeof preopens === 'object' && preopens !== null) {
52-
ArrayPrototypeForEach(ObjectKeys(preopens), (key) => {
53-
preopenArray.push(String(key));
54-
preopenArray.push(String(preopens[key]));
55-
});
52+
for (const [key, value] of ObjectEntries(preopens)) {
53+
ArrayPrototypePush(preopenArray, String(key), String(value));
54+
}
5655
} else if (preopens !== undefined) {
5756
throw new ERR_INVALID_ARG_TYPE('options.preopens', 'Object', preopens);
5857
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.