Use ...arguments syntax instaed of .apply() and .concat() master
authorNick Downing <nick@ndcode.org>
Sun, 9 Jan 2022 12:24:01 +0000 (23:24 +1100)
committerNick Downing <nick@ndcode.org>
Sun, 9 Jan 2022 12:24:01 +0000 (23:24 +1100)
JSTCache.js

index be400c9..7522b6b 100644 (file)
@@ -65,21 +65,22 @@ JSTCache.prototype.build = async function(key, result) {
   assert(render.deps.length === 0)
   let full_pathname = require.resolve(render.pathname)
   delete require.cache[full_pathname]
-  result.value = await (require(full_pathname)).apply(
-    null,
-    [
-      async pathname => {
-        let temp = path.posix.dirname(key)
-        while (pathname.charAt(0) === '/') {
-          temp = this.root
-          pathname = pathname.slice(1)
-        }
-        pathname = path.posix.resolve(temp, pathname)
-        return this.get(pathname)
-      },
-      key,
-      this.root
-    ].concat(this.arg_values)
+  result.value = await require(full_pathname)(
+    // _require
+    async pathname => {
+      let temp = path.posix.dirname(key)
+      while (pathname.charAt(0) === '/') {
+        temp = this.root
+        pathname = pathname.slice(1)
+      }
+      pathname = path.posix.resolve(temp, pathname)
+      return this.get(pathname)
+    },
+    // _pathname
+    key,
+    // _root
+    this.root,
+    ...this.arg_values
   )
 }