@types/js-schema
TypeScript icon, indicating that this package has built-in type declarations

0.0.34 • Public • Published

Installation

npm install --save @types/js-schema

Summary

This package contains type definitions for js-schema (https://github.com/molnarg/js-schema).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/js-schema.

index.d.ts

declare module "js-schema" {
    function schema(definition: any): schema.Schema;

    namespace schema {
        interface Schema {
            (obj: any): boolean; // test obj against the schema
        }
    }

    export = schema;
}

interface NumberConstructor {
    min(n: number): NumberConstructor;
    max(n: number): NumberConstructor;
    below(n: number): NumberConstructor;
    above(n: number): NumberConstructor;
    step(n: number): NumberConstructor;
}

interface StringConstructor {
    of(charset: string): StringConstructor;
    of(length: number, charset: string): StringConstructor;
    of(minLength: number, maxLength: number, charset: string): StringConstructor;
}

interface ArrayConstructor {
    like(arr: any[]): ArrayConstructor;
    of(pattern: any): ArrayConstructor;
    of(length: number, pattern: any): ArrayConstructor;
    of(minLength: number, maxLength: number, pattern: any): ArrayConstructor;
}

interface ObjectConstructor {
    like(obj: any): ObjectConstructor;
    reference(obj: any): ObjectConstructor;
}

interface FunctionConstructor {
    reference(func: Function): FunctionConstructor;
}

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: none

Credits

These definitions were written by Marcin Porebski, and Robin Labat.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @types/js-schema

      Weekly Downloads

      26

      Version

      0.0.34

      License

      MIT

      Unpacked Size

      5.03 kB

      Total Files

      5

      Last publish

      Collaborators

      • types