Skip to content

valueIn

valueIn<T>(path, values): SchemaRule

Defined in: projects/ngx-signal-schema/src/lib/conditions/value-in.ts:23

Checks if a field’s value is contained within a list of expected values. If you need the other way round, use includes

valueIn is a semantic shortcut for:

(ctx) => ctx.valueOf(path.someField) in ['val1', 'val2']

T

SchemaPath<T>

The path to the field to check.

readonly T[] | (() => readonly T[])

The array of values to compare against, or a function returning them.

SchemaRule

A rule function that returns true if the value is in the set.

applyWhen(path.field, valueIn(path.other, ['val1', 'val2']), required);