diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-01-10 22:54:54 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-01-10 22:54:54 -0400 |
commit | 63c57c36886e5cdfaf8facdb50f3384b24c58ebf (patch) | |
tree | 3cf935397cd1df734ec44c55335950ee97dea3fa /src/data/composite/wiki-data/inputSoupyFind.js | |
parent | 7f987f5981e20932bb9039252349ecefdc2379ef (diff) |
data: inputSoupyFind, gobbleSoupyFind
Diffstat (limited to 'src/data/composite/wiki-data/inputSoupyFind.js')
-rw-r--r-- | src/data/composite/wiki-data/inputSoupyFind.js | 22 |
1 files changed, 22 insertions, 0 deletions
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); +} |