summaryrefslogtreecommitdiff
path: root/ext/fs/30_fs.js
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2023-05-01 22:30:02 +0900
committerGitHub <noreply@github.com>2023-05-01 15:30:02 +0200
commit6728ad4203d731e555dabf89ec6157f113454ce6 (patch)
tree956dc2d403b5a6ef107c35cab1ccc259ad4d86a1 /ext/fs/30_fs.js
parent94a148cdb6f7660518c75a3c20109bf64848f0f1 (diff)
fix(core): Use primordials for methods (#18839)
I would like to get this change into Deno before merging https://github.com/denoland/deno_lint/pull/1152
Diffstat (limited to 'ext/fs/30_fs.js')
-rw-r--r--ext/fs/30_fs.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js
index bddafb09e..8766d32ff 100644
--- a/ext/fs/30_fs.js
+++ b/ext/fs/30_fs.js
@@ -7,12 +7,15 @@ const {
ArrayPrototypeFilter,
Date,
DatePrototype,
+ DatePrototypeGetTime,
Error,
Function,
MathTrunc,
ObjectEntries,
ObjectPrototypeIsPrototypeOf,
ObjectValues,
+ StringPrototypeSlice,
+ StringPrototypeStartsWith,
SymbolAsyncIterator,
SymbolIterator,
Uint32Array,
@@ -232,8 +235,8 @@ function createByteStruct(types) {
for (let i = 0; i < typeEntries.length; ++i) {
let { 0: name, 1: type } = typeEntries[i];
- const optional = type.startsWith("?");
- if (optional) type = type.slice(1);
+ const optional = StringPrototypeStartsWith(type, "?");
+ if (optional) type = StringPrototypeSlice(type, 1);
if (type == "u64") {
if (!optional) {
@@ -369,7 +372,7 @@ async function link(oldpath, newpath) {
function toUnixTimeFromEpoch(value) {
if (ObjectPrototypeIsPrototypeOf(DatePrototype, value)) {
- const time = value.valueOf();
+ const time = DatePrototypeGetTime(value);
const seconds = MathTrunc(time / 1e3);
const nanoseconds = MathTrunc(time - (seconds * 1e3)) * 1e6;