• Validates an object against to a JOI schema

    Type Parameters

    • T

    Parameters

    • item: unknown

      the javascript object to be parsed.

    • schema: Schema<any>

      the [JOI.schema object](https://joi.dev/api/)

    • options: Options = {}

      an object with a message value. See example.

    Returns T

    the objected converted to the given type

    Example

    import { validate } from "@eng-automation/js";
    import { configSchema } from "./utils";

    const myConfig: unknown = JSON.parse(jsonString);
    const config: ConfigurationFile validate<ConfigurationFile>(config, configSchema, { message: "Configuration file is invalid" });