blob: 0b0a23fe14bfd2949ce0ddface3906694f1433bc (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 | import {input} from '#composite';
import {anyOf, isFunction, isString} from '#validators';
function inputSoupyReverse() {
  return input({
    validate:
      anyOf(
        isFunction,
        val => {
          isString(val);
          if (!val.startsWith('_soupyReverse:')) {
            throw new Error(`Expected soupyReverse.input() token`);
          }
          return true;
        }),
  });
}
inputSoupyReverse.input = key =>
  input.value('_soupyReverse:' + key);
export default inputSoupyReverse;
export function getSoupyReverseInputKey(value) {
  return value.slice('_soupyReverse:'.length).replace(/\.unique$/, '');
}
export function doesSoupyReverseInputWantUnique(value) {
  return value.endsWith('.unique');
}
 |