diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2026-01-23 20:48:02 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2026-01-23 21:25:54 -0400 |
| commit | 9bdcf0476f4b222cb806755510b1dc3d4d545e1e (patch) | |
| tree | eebfe47b2b50f26ac372fb3b3b8fe200e5262a59 | |
| parent | 723a8b9e79601f445fd83517ba93c75e93368b47 (diff) | |
find, data, checks: dummy 'from' option in find()
| -rw-r--r-- | src/data/checks.js | 11 | ||||
| -rw-r--r-- | src/data/composite/wiki-data/withResolvedReference.js | 7 | ||||
| -rw-r--r-- | src/data/composite/wiki-data/withResolvedReferenceList.js | 7 | ||||
| -rw-r--r-- | src/find.js | 2 |
4 files changed, 21 insertions, 6 deletions
diff --git a/src/data/checks.js b/src/data/checks.js index ebf6aad4..2b660421 100644 --- a/src/data/checks.js +++ b/src/data/checks.js @@ -229,6 +229,16 @@ function decoSuppressFindErrors(findFn, {property}) { }, findFn); } +function decoFindThing(findFn, thing) { + return (ref, opts) => { + if (opts) { + return findFn(ref, {...opts, from: thing}); + } else { + return findFn(ref, {from: thing}); + } + }; +} + // Warn about references across data which don't match anything. This involves // using the find() functions on all references, setting it to 'error' mode, and // collecting everything in a structured logged (which gets logged if there are @@ -549,6 +559,7 @@ export function filterReferenceErrors(wikiData, { findFn = decoSuppressFindErrors(findFn, {property}); findFn = decoAnnotateFindErrors(findFn); + findFn = decoFindThing(findFn, thing); const fieldPropertyMessage = getFieldPropertyMessage( diff --git a/src/data/composite/wiki-data/withResolvedReference.js b/src/data/composite/wiki-data/withResolvedReference.js index d9a05367..58523a65 100644 --- a/src/data/composite/wiki-data/withResolvedReference.js +++ b/src/data/composite/wiki-data/withResolvedReference.js @@ -38,14 +38,15 @@ export default templateCompositeFrom({ }), { - dependencies: [input('findOptions')], + dependencies: [input('findOptions'), input.myself()], compute: (continuation, { [input('findOptions')]: findOptions, + [input.myself()]: myself, }) => continuation({ ['#findOptions']: (findOptions - ? {...findOptions, mode: 'quiet'} - : {mode: 'quiet'}), + ? {...findOptions, mode: 'quiet', from: myself} + : {mode: 'quiet', from: myself}), }), }, diff --git a/src/data/composite/wiki-data/withResolvedReferenceList.js b/src/data/composite/wiki-data/withResolvedReferenceList.js index 14ce6919..23f3c365 100644 --- a/src/data/composite/wiki-data/withResolvedReferenceList.js +++ b/src/data/composite/wiki-data/withResolvedReferenceList.js @@ -49,14 +49,15 @@ export default templateCompositeFrom({ }), { - dependencies: [input('findOptions')], + dependencies: [input('findOptions'), input.myself()], compute: (continuation, { [input('findOptions')]: findOptions, + [input.myself()]: myself, }) => continuation({ ['#findOptions']: (findOptions - ? {...findOptions, mode: 'quiet'} - : {mode: 'quiet'}), + ? {...findOptions, mode: 'quiet', from: myself} + : {mode: 'quiet', from: myself}), }), }, diff --git a/src/find.js b/src/find.js index 5740ebd4..7b2ea7e0 100644 --- a/src/find.js +++ b/src/find.js @@ -288,6 +288,8 @@ function findHelper({ // console. mode = 'warn', + from = null, + fuzz = { capitalization: false, kebab: false, |