From cc0049466a687c578b6f6c5244df99a4f782eff4 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Sun, 21 Jan 2024 11:30:22 +0100 Subject: [PATCH] Add property access function --- npm/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/npm/index.js b/npm/index.js index 62bc55f..f6a2a17 100644 --- a/npm/index.js +++ b/npm/index.js @@ -46,6 +46,14 @@ void async function main() { const skip = Symbol('skip') +const wrap = fn => new Proxy(fn, { + get(_, prop) { + return wrap(x => fn(x)?.[prop]) + }, +}) + +const _ = wrap(x => x) + async function runTransforms(json, args, theme) { const process = await import('node:process') let i, code, jsCode, output = json