summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2020-08-15 01:43:11 +0800
committerGitHub <noreply@github.com>2020-08-14 13:43:11 -0400
commit238816d62fcc1cfe16414751902fa5a924b14703 (patch)
tree7f2dd65095b2f85736f9c3783e01a4eff8b785a9
parenta17ea9150d08312ecd2779324fff09ee7cd99037 (diff)
refactor(cli/rt): inline single line single use open helper functions (#7046)
-rw-r--r--cli/rt/30_files.js24
1 files changed, 9 insertions, 15 deletions
diff --git a/cli/rt/30_files.js b/cli/rt/30_files.js
index 0b6d9c67f..9ff2fe368 100644
--- a/cli/rt/30_files.js
+++ b/cli/rt/30_files.js
@@ -22,25 +22,14 @@
return sendAsync("op_seek", { rid, offset, whence });
}
- function opOpenSync(path, options) {
- const mode = options?.mode;
- return sendSync("op_open", { path: pathFromURL(path), options, mode });
- }
-
- function opOpen(
- path,
- options,
- ) {
- const mode = options?.mode;
- return sendAsync("op_open", { path: pathFromURL(path), options, mode });
- }
-
function openSync(
path,
options = { read: true },
) {
checkOpenOptions(options);
- const rid = opOpenSync(path, options);
+ const mode = options?.mode;
+ const rid = sendSync("op_open", { path: pathFromURL(path), options, mode });
+
return new File(rid);
}
@@ -49,7 +38,12 @@
options = { read: true },
) {
checkOpenOptions(options);
- const rid = await opOpen(path, options);
+ const mode = options?.mode;
+ const rid = await sendAsync(
+ "op_open",
+ { path: pathFromURL(path), options, mode },
+ );
+
return new File(rid);
}