Skip to content

includes ​

The string contains value.

Signature ​

ts
function includes(value: string, msg?: Message): Action<string>

Parameters ​

ParameterTypeDescription
valuestringThe substring
msgMessageCustom error message

Error codes ​

CodeWhenDefault message
includesThe condition is not metMust contain "{value}"

You can change the texts: see Messages & i18n.

Notes ​

Case-sensitive. To ignore case, add toLowerCase before the rule.

Example ​

ts
pipe(string(), includes('@'))

See also ​