nonTrimmed

Creates a non-trimmed validation action.

nonTrimmed is the opposite of trimmed. Since an empty string has no leading or trailing whitespace, it is also rejected.

const Action = v.nonTrimmed<TInput, TMessage>(message);

Generics

Parameters

  • message TMessage

Explanation

With nonTrimmed you can validate that a string has leading or trailing whitespace. If the input is trimmed, you can use message to customize the error message.

Returns

Examples

The following examples show how nonTrimmed can be used.

Indented line schema

Schema to validate that a line starts or ends with whitespace.

const IndentedLineSchema = v.pipe(
  v.string(),
  v.nonTrimmed('The line must start or end with whitespace.')
);

The following APIs can be combined with nonTrimmed.

Schemas

Methods

Utils

Contributors

Thanks to all the contributors who helped make this page better!

  • GitHub profile picture of @fabian-hiller

Partners

Thanks to our partners who support the project ideally and financially.

Sponsors

Thanks to our GitHub sponsors who support the project financially.

  • GitHub profile picture of @evilmartians
  • GitHub profile picture of @vasilii-kovalev
  • GitHub profile picture of @ruiaraujo012
  • GitHub profile picture of @hyunbinseo
  • GitHub profile picture of @nickytonline
  • GitHub profile picture of @kibertoad
  • GitHub profile picture of @caegdeveloper
  • GitHub profile picture of @Thanaen
  • GitHub profile picture of @ysknsid25
  • GitHub profile picture of @dslatkin