Interface Operation

An operation that a shape applies to its output.

Template: Value

The shape output value to which the operation must be applied.

See

interface Operation {
    callback: OperationCallback<Result<any>, any, any> | OperationCallback<PromiseLike<Result<any>>, any, any>;
    isAsync: boolean;
    param: any;
    tolerance: OperationTolerance;
    type: any;
}

Properties

callback: OperationCallback<Result<any>, any, any> | OperationCallback<PromiseLike<Result<any>>, any, any>

The callback that applies the logic of the operation to the shape output.

isAsync: boolean

true if the operation callback may return a promise, or false otherwise.

param: any

The additional param associated with the operation. Usually contains a Operation.type-specific data is used in the Operation.callback.

The operation tolerance for issues that are raised during validation.

  • If skip then if preceding operations have raised issues, then this operation is skipped but consequent operations are still applied.
  • If abort then if preceding operations have raised issues, then this operation is skipped and consequent operations aren't applied. Also, if this operation itself raises issues then consequent operations aren't applied.
  • If auto then the operation is applied regardless of previously raised issues.
type: any

The type of the operation such as "string.regex" or "array.includes".