npm.io
1.0.33 • Published 2 years ago

@types/jjv

Licence
MIT
Version
1.0.33
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/jjv

Summary

This package contains type definitions for jjv (https://github.com/acornejo/jjv).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jjv.

index.d.ts

declare function jjv(): jjv.Env;

declare namespace jjv {
    interface Errors {
        validation: {
            [property: string]: {
                required?: boolean | undefined;
                type?: string | undefined;
            };
        };
    }

    interface Options {
        checkRequired?: boolean | undefined;
        useDefault?: boolean | undefined;
        useCoerce?: boolean | undefined;
        removeAdditional?: boolean | undefined;
    }

    interface Env {
        defaultOptions: Options;

        addSchema(name: string, schema: Object): void;

        addType(name: string, parse: (input: any) => any): void;
        addFormat(name: string, parse: (input: any) => any): void;
        addCheck(name: string, check: (input: any, comparator: any) => any): void;
        addTypeCoercion(name: string, coerce: (input: any) => any): void;

        validate(name: string, object: any, options?: Options): Errors;
        validate(schema: Object, object: any, options?: Options): Errors;
    }
}

export = jjv;

Additional Details

  • Last updated: Tue, 07 Nov 2023 0337 GMT
  • Dependencies: none

Credits

These definitions were written by Wim Looman.