diff options
author | Aapo Alasuutari <aapo.alasuutari@gmail.com> | 2022-03-19 11:26:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-19 18:26:54 +0900 |
commit | ad8e2383487e8ef4f15e7b86df80f6dc98fdcc79 (patch) | |
tree | 4fa99c3d7685b38c838150b82096885d8de23127 | |
parent | b01bc7faff5d9c034160fd41c507642c36b82b97 (diff) |
chore(core,ext): minor JS optimisations (#13950)
-rw-r--r-- | core/01_core.js | 5 | ||||
-rw-r--r-- | ext/net/01_net.js | 4 | ||||
-rw-r--r-- | ext/webidl/00_webidl.js | 18 |
3 files changed, 14 insertions, 13 deletions
diff --git a/core/01_core.js b/core/01_core.js index 747d69241..eb57d273e 100644 --- a/core/01_core.js +++ b/core/01_core.js @@ -27,7 +27,10 @@ SymbolFor, } = window.__bootstrap.primordials; const ops = window.Deno.core.ops; - const opIds = Object.keys(ops).reduce((a, v, i) => ({ ...a, [v]: i }), {}); + const opIds = Object.keys(ops).reduce((a, v, i) => { + a[v] = i; + return a; + }, {}); // Available on start due to bindings. const { refOp_, unrefOp_ } = window.Deno.core; diff --git a/ext/net/01_net.js b/ext/net/01_net.js index 803205319..11d6fbfac 100644 --- a/ext/net/01_net.js +++ b/ext/net/01_net.js @@ -279,9 +279,7 @@ } send(p, addr) { - const remote = { hostname: "127.0.0.1", ...addr }; - - const args = { ...remote, rid: this.rid }; + const args = { hostname: "127.0.0.1", ...addr, rid: this.rid }; return opSend(args, p); } diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js index de3221081..a7f0597b1 100644 --- a/ext/webidl/00_webidl.js +++ b/ext/webidl/00_webidl.js @@ -183,7 +183,7 @@ const twoToOneLessThanTheBitLength = MathPow(2, bitLength - 1); return (V, opts = {}) => { - let x = toNumber(V, opts); + let x = toNumber(V); x = censorNegativeZero(x); if (opts.enforceRange) { @@ -236,7 +236,7 @@ const asBigIntN = unsigned ? BigIntAsUintN : BigIntAsIntN; return (V, opts = {}) => { - let x = toNumber(V, opts); + let x = toNumber(V); x = censorNegativeZero(x); if (opts.enforceRange) { @@ -300,7 +300,7 @@ }); converters.float = (V, opts) => { - const x = toNumber(V, opts); + const x = toNumber(V); if (!NumberIsFinite(x)) { throw makeException( @@ -327,8 +327,8 @@ return y; }; - converters["unrestricted float"] = (V, opts) => { - const x = toNumber(V, opts); + converters["unrestricted float"] = (V, _opts) => { + const x = toNumber(V); if (isNaN(x)) { return x; @@ -342,7 +342,7 @@ }; converters.double = (V, opts) => { - const x = toNumber(V, opts); + const x = toNumber(V); if (!NumberIsFinite(x)) { throw makeException( @@ -355,8 +355,8 @@ return x; }; - converters["unrestricted double"] = (V, opts) => { - const x = toNumber(V, opts); + converters["unrestricted double"] = (V, _opts) => { + const x = toNumber(V); return x; }; @@ -714,7 +714,7 @@ throw makeException( TypeError, `can not be converted to '${name}' because '${key}' is required in '${name}'.`, - { ...opts }, + opts, ); } } |