From 63c57c36886e5cdfaf8facdb50f3384b24c58ebf Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 10 Jan 2025 22:54:54 -0400 Subject: data: inputSoupyFind, gobbleSoupyFind --- src/data/composite/wiki-data/inputSoupyFind.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/data/composite/wiki-data/inputSoupyFind.js (limited to 'src/data/composite/wiki-data/inputSoupyFind.js') diff --git a/src/data/composite/wiki-data/inputSoupyFind.js b/src/data/composite/wiki-data/inputSoupyFind.js new file mode 100644 index 00000000..4ae7bd3b --- /dev/null +++ b/src/data/composite/wiki-data/inputSoupyFind.js @@ -0,0 +1,22 @@ +import {input} from '#composite'; +import {anyOf, isFunction, isString} from '#validators'; + +export default () => + input({ + validate: + anyOf( + isFunction, + val => { + isString(val); + + if (!val.startsWith('_soupyFind:')) { + throw new Error(`Expected soupyFind.input() token`); + } + + return true; + }), + }); + +export function getSoupyFindInputKey(value) { + return value.slice('_soupyFind:'.length); +} -- cgit 1.3.0-6-gf8a5