Skip to content

Files

39 lines (26 loc) · 758 Bytes

File metadata and controls

39 lines (26 loc) · 758 Bytes

import CodeExample from '@docs/code-example' import DocPage from '@docs/doc-page';

Is

Simple value

is - test if the value is equal

condition: {
  when: 'Foo',
  is: 'Bar',
}

// Foo == 'Bar' => true
// Foo == 'Not a Bar' => false

Custom Function

(value: any, config: condition object) => boolean

is also allows to use a custom function. This function receives the value of the when field as the first attribute and the condition config as the second argument.

condition: {
  when: 'Foo',
  is: (value, config) => calculateAge(value, config) > 18
}