AniLink - v2.0.0
    Preparing search index...

    Function validateVariables

    • Validates the provided variables against the expected types.

      Unknown variables and properties are rejected by default; pass { rejectUnknownKeys: false } to ignore them instead. An empty variables object is a valid no-op, and validation failures throw an AniLinkValidationError whose details property lists every problem.

      Parameters

      • variables: object

        The variables to validate. Each key is the name of a variable and the value is the value of the variable.

      • variableTypeMappings: VariableTypeMappings

        A map of variable names to their expected types. The expected type can be a primitive type name, an array type name, an allowlist of accepted values, or a nested object mapping.

      • Optionaloptions: { rejectUnknownKeys?: boolean }

        Optional validation behaviour flags. Set rejectUnknownKeys to false to ignore unknown variable keys and unknown object properties instead of rejecting them.

      Returns void

      Nothing when every supplied value matches its mapping.

      An AniLinkValidationError when a variable does not match its expected type or when a variable or property key is unknown.