summaryrefslogtreecommitdiff
path: root/runtime/js/30_fs.js
diff options
context:
space:
mode:
authorSimon Rask <33556894+SimonRask@users.noreply.github.com>2021-07-03 17:17:23 +0200
committerGitHub <noreply@github.com>2021-07-03 17:17:23 +0200
commit51de4e1f7cb7839f22e324473cec942717c517e7 (patch)
treef596dfd994a0ecd6d87e7cdf444031edbb73347c /runtime/js/30_fs.js
parentbd7bb43a0e1059473a7930fe15f01e3e1954ef02 (diff)
refactor: use primordials for `13_buffer.js` and `30_fs.js` (#11247)
Diffstat (limited to 'runtime/js/30_fs.js')
-rw-r--r--runtime/js/30_fs.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/runtime/js/30_fs.js b/runtime/js/30_fs.js
index 913158a34..e45cda321 100644
--- a/runtime/js/30_fs.js
+++ b/runtime/js/30_fs.js
@@ -3,6 +3,12 @@
((window) => {
const core = window.Deno.core;
+ const {
+ Date,
+ MathTrunc,
+ SymbolAsyncIterator,
+ SymbolIterator,
+ } = window.__bootstrap.primordials;
const { pathFromURL } = window.__bootstrap.util;
const build = window.__bootstrap.build.build;
@@ -103,7 +109,7 @@
function readDirSync(path) {
return core.opSync("op_read_dir_sync", pathFromURL(path))[
- Symbol.iterator
+ SymbolIterator
]();
}
@@ -113,7 +119,7 @@
pathFromURL(path),
);
return {
- async *[Symbol.asyncIterator]() {
+ async *[SymbolAsyncIterator]() {
yield* await array;
},
};
@@ -273,8 +279,8 @@
function toUnixTimeFromEpoch(value) {
if (value instanceof Date) {
const time = value.valueOf();
- const seconds = Math.trunc(time / 1e3);
- const nanoseconds = Math.trunc(time - (seconds * 1e3)) * 1e6;
+ const seconds = MathTrunc(time / 1e3);
+ const nanoseconds = MathTrunc(time - (seconds * 1e3)) * 1e6;
return [
seconds,