@vinejs/vine - v4.0.0-next.1
    Preparing search index...

    Class VineRecord<Schema>

    VineRecord represents an object of key-value pair in which keys are unknown

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    "[ITYPE]": { [K: string]: Schema[typeof ITYPE] }

    Define the input type of the schema for TypeScript inference

    "[OTYPE]": { [K: string]: Schema[typeof OTYPE] }

    The output value type of the field after validation. The property points to a type only and not the real value.

    "[COTYPE]": { [K: string]: Schema[typeof COTYPE] }

    Type marker for camelCase output type inference

    rules: {
        maxLength: (
            ...options: [options: { max: number }],
        ) => Validation<{ max: number }>;
        minLength: (
            ...options: [options: { min: number }],
        ) => Validation<{ min: number }>;
        fixedLength: (
            ...options: [options: { size: number }],
        ) => Validation<{ size: number }>;
        validateKeys: (
            ...options: [options: (keys: string[], field: FieldContext) => void],
        ) => Validation<(keys: string[], field: FieldContext) => void>;
    } = ...

    Default collection of record rules

    "[UNIQUE_NAME]": string = 'vine.object'

    The property must be implemented for "unionOfTypes"

    Methods

    • Define a method to parse the input value. The method is invoked before any validation and hence you must perform type-checking to know the value you are working with.

      Parameters

      • callback: ParseFn

        Parser function to transform the input value

      Returns this

      This schema instance for method chaining

      vine.string().parse((value) => {
      return typeof value === 'string' ? value.trim() : value
      })
    • Checks if the value is of object type. The method must be implemented for "unionOfTypes"

      Parameters

      • value: unknown

      Returns boolean