From edad98e0408571e4c6cabceaa5234510cefaaea5 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 11 Jan 2025 17:33:58 -0400 Subject: reverse: bindTo 'wikiData' --- src/find-reverse.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/find-reverse.js') diff --git a/src/find-reverse.js b/src/find-reverse.js index 1e897a5c..f31d3c45 100644 --- a/src/find-reverse.js +++ b/src/find-reverse.js @@ -108,20 +108,24 @@ export function bind(wikiData, opts1, { if (!spec.bindTo) continue; const behavior = prepareBehavior(spec); - const thingData = wikiData[spec.bindTo]; + + const data = + (spec.bindTo === 'wikiData' + ? wikiData + : wikiData[spec.bindTo]); bound[key] = (opts1 ? (ref, opts2) => (opts2 - ? behavior(ref, thingData, {...opts1, ...opts2}) - : behavior(ref, thingData, opts1)) + ? behavior(ref, data, {...opts1, ...opts2}) + : behavior(ref, data, opts1)) : (ref, opts2) => (opts2 - ? behavior(ref, thingData, opts2) - : behavior(ref, thingData))); + ? behavior(ref, data, opts2) + : behavior(ref, data))); - bound[key][boundData] = thingData; + bound[key][boundData] = data; bound[key][boundOptions] = opts1 ?? {}; } -- cgit 1.3.0-6-gf8a5