Basically, allow this:
foo?.bar = value;
which is equivalent to
foo == null ? undefined : (foo.bar = value);
const CH_BRACE_L = 0x7b as const; | |
const CH_BRACE_R = 0x7d as const; | |
const CH_SQUARE_L = 0x5b as const; | |
const CH_SQUARE_R = 0x5d as const; | |
const CH_QUOTE_D = 0x22 as const; | |
const CH_ESCAPE = 0x5c as const; | |
const CH_COMMA = 0x2c as const; | |
const CH_COLON = 0x3a as const; | |
const CH_DOT = 0x2e as const; | |
const CH_MINUS = 0x2d as const; |
This for loop:
for (let i = 0, getI = () => i; i < 3; i++)
console.log(getI());
unrolls to:
"use strict"; | |
const synchronize = require("./synchronize.cjs"); | |
synchronize.export({ | |
async getMyObj(value) { | |
await new Promise((resolve) => setTimeout(resolve, 2000)); | |
return { foo: value * 3 }; | |
} | |
}); |
var unshift = Function.call.bind([].unshift); | |
var test = Function.call.bind(/./.test); | |
function update(ar) { | |
unshift(ar, ar[ar.length - 1]); | |
} | |
function fn(check, id) { | |
if (check != true) throw new Error("check must be true"); | |
if (id != 1 && id != 2) throw new Error("id must be 1 or 2"); |
import { pascal, binomePower } from "./math.js"; | |
console.log(pascal(10)); // [1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1] | |
console.log(binomePower(3)); // "x^3 + 3x^2y + 3xy^2 + y^3" |
const Y = a=>(a=>a(a))(b=>a((...a)=>b(b)(...a))); | |
// Usage | |
/* | |
* var result = Y((the function itself) => (...parameters) => { | |
* return result; | |
* })(...parameters); | |
* | |
*/ |