@types/mockjs

  • Version 1.0.10
  • Published
  • 9.95 kB
  • No dependencies
  • MIT license

Install

npm i @types/mockjs
yarn add @types/mockjs
pnpm add @types/mockjs

Overview

TypeScript definitions for mockjs

Index

Variables

variable mock

let mock: MockjsMock;

    variable Random

    let Random: MockjsRandom;

      variable setup

      let setup: MockjsSetup;

        variable toJSONSchema

        let toJSONSchema: MockjsToJSONSchema;

          variable valid

          let valid: MockjsValid;

            variable version

            let version: number;

              Interfaces

              interface Mockjs

              interface Mockjs {}

                property mock

                mock: MockjsMock;

                  property Random

                  Random: MockjsRandom;

                    property setup

                    setup: MockjsSetup;

                      property toJSONSchema

                      toJSONSchema: MockjsToJSONSchema;

                        property valid

                        valid: MockjsValid;

                          property version

                          version: number;

                            interface MockjsMock

                            interface MockjsMock {}

                              call signature

                              (rurl: S | RegExp, rtype: S, template: templateOrFn): Mockjs;

                                call signature

                                (rurl: S | RegExp, template: templateOrFn): Mockjs;

                                  call signature

                                  (template: any): any;

                                    interface MockjsRandom

                                    interface MockjsRandom
                                    extends MockjsRandomBasic,
                                    MockjsRandomDate,
                                    MockjsRandomImage,
                                    MockjsRandomColor,
                                    MockjsRandomAddress,
                                    MockjsRandomHelper,
                                    MockjsRandomMiscellaneous,
                                    MockjsRandomName,
                                    MockjsRandomText,
                                    MockjsRandomWeb,
                                    MockjsRandomExtendOption {}

                                      method extend

                                      extend: (extendOption: MockjsRandomExtendOption) => MockjsRandom;

                                        interface MockjsRandomAddress

                                        interface MockjsRandomAddress {}

                                          method city

                                          city: (prefix?: B) => S;

                                            method county

                                            county: (prefix?: B) => S;

                                              method province

                                              province: () => S;

                                                method region

                                                region: () => S;

                                                  method zip

                                                  zip: (prefix?: B) => S;

                                                    interface MockjsRandomBasic

                                                    interface MockjsRandomBasic {}

                                                      method boolean

                                                      boolean: { (min: N, max: N, current: B): B; (): boolean };

                                                        method character

                                                        character: {
                                                        (pool: 'lower' | 'upper' | 'number' | 'symbol'): S;
                                                        (pool?: string): string;
                                                        };

                                                          method float

                                                          float: (min?: N, max?: N, dmin?: N, dmax?: N) => N;

                                                            method integer

                                                            integer: (min?: N, max?: N) => N;

                                                              method natural

                                                              natural: (min?: N, max?: N) => N;

                                                                method range

                                                                range: (start?: N, stop?: N, step?: N) => N[];

                                                                  method string

                                                                  string: (pool?: S | N, min?: N, max?: N) => S;

                                                                    interface MockjsRandomColor

                                                                    interface MockjsRandomColor {}

                                                                      method color

                                                                      color: () => S;

                                                                        method hex

                                                                        hex: () => S;

                                                                          method hsl

                                                                          hsl: () => S;

                                                                            method rgb

                                                                            rgb: () => S;

                                                                              method rgba

                                                                              rgba: () => S;

                                                                                interface MockjsRandomDate

                                                                                interface MockjsRandomDate {}

                                                                                  method date

                                                                                  date: (format?: S) => S;

                                                                                    method datetime

                                                                                    datetime: (format?: S) => S;

                                                                                      method now

                                                                                      now: { (util: RandomDateUtilString, format?: S): S; (format?: string): string };

                                                                                        method time

                                                                                        time: (format?: S) => S;

                                                                                          interface MockjsRandomExtendOption

                                                                                          interface MockjsRandomExtendOption {}

                                                                                            index signature

                                                                                            [randomType: string]: (...args: any[]) => any;

                                                                                              interface MockjsRandomHelper

                                                                                              interface MockjsRandomHelper {}

                                                                                                method capitalize

                                                                                                capitalize: (word: S) => S;

                                                                                                  method lower

                                                                                                  lower: (str: S) => S;

                                                                                                    method pick

                                                                                                    pick: (arr: any[]) => any;

                                                                                                      method shuffle

                                                                                                      shuffle: (arr: any[]) => any[];

                                                                                                        method upper

                                                                                                        upper: (str: S) => S;

                                                                                                          interface MockjsRandomImage

                                                                                                          interface MockjsRandomImage {}

                                                                                                            method dataImage

                                                                                                            dataImage: (size?: S, text?: S) => S;

                                                                                                              method image

                                                                                                              image: (
                                                                                                              size?: S,
                                                                                                              background?: S,
                                                                                                              foreground?: S,
                                                                                                              format?: RandomImageFormatString | S,
                                                                                                              text?: S
                                                                                                              ) => S;

                                                                                                                interface MockjsRandomMiscellaneous

                                                                                                                interface MockjsRandomMiscellaneous {}

                                                                                                                  method guid

                                                                                                                  guid: () => S;

                                                                                                                    method id

                                                                                                                    id: () => S;

                                                                                                                      method increment

                                                                                                                      increment: (step?: N) => N;

                                                                                                                        interface MockjsRandomName

                                                                                                                        interface MockjsRandomName {}

                                                                                                                          method cfirst

                                                                                                                          cfirst: () => S;

                                                                                                                            method clast

                                                                                                                            clast: () => S;

                                                                                                                              method cname

                                                                                                                              cname: () => S;

                                                                                                                                method first

                                                                                                                                first: () => S;

                                                                                                                                  method last

                                                                                                                                  last: () => S;

                                                                                                                                    method name

                                                                                                                                    name: (middle?: B) => S;

                                                                                                                                      interface MockjsRandomText

                                                                                                                                      interface MockjsRandomText {}

                                                                                                                                        method cparagraph

                                                                                                                                        cparagraph: (min?: N, max?: N) => S;

                                                                                                                                          method csentence

                                                                                                                                          csentence: (min?: N, max?: N) => S;

                                                                                                                                            method ctitle

                                                                                                                                            ctitle: (min?: N, max?: N) => S;

                                                                                                                                              method cword

                                                                                                                                              cword: (pool?: S | N, min?: N, max?: N) => S;

                                                                                                                                                method paragraph

                                                                                                                                                paragraph: (min?: N, max?: N) => S;

                                                                                                                                                  method sentence

                                                                                                                                                  sentence: (min?: N, max?: N) => S;

                                                                                                                                                    method title

                                                                                                                                                    title: (min?: N, max?: N) => S;

                                                                                                                                                      method word

                                                                                                                                                      word: (min?: N, max?: N) => S;

                                                                                                                                                        interface MockjsRandomWeb

                                                                                                                                                        interface MockjsRandomWeb {}

                                                                                                                                                          method domain

                                                                                                                                                          domain: () => S;

                                                                                                                                                            method dtl

                                                                                                                                                            dtl: () => S;

                                                                                                                                                              method email

                                                                                                                                                              email: (domain?: S) => S;

                                                                                                                                                                method ip

                                                                                                                                                                ip: () => S;

                                                                                                                                                                  method protocal

                                                                                                                                                                  protocal: () => RandomWebProtocal;

                                                                                                                                                                    method url

                                                                                                                                                                    url: (protocol?: S, host?: S) => S;

                                                                                                                                                                      interface MockjsRequestOptions

                                                                                                                                                                      interface MockjsRequestOptions {}

                                                                                                                                                                        property body

                                                                                                                                                                        body: any;

                                                                                                                                                                          property type

                                                                                                                                                                          type: string;

                                                                                                                                                                            property url

                                                                                                                                                                            url: string;

                                                                                                                                                                              interface MockjsSetupSettings

                                                                                                                                                                              interface MockjsSetupSettings {}

                                                                                                                                                                                property timeout

                                                                                                                                                                                timeout?: number | S | undefined;

                                                                                                                                                                                  interface MockjsToJSONSchemaRs

                                                                                                                                                                                  interface MockjsToJSONSchemaRs {}

                                                                                                                                                                                    property items

                                                                                                                                                                                    items?: MockjsToJSONSchemaRs[] | undefined;

                                                                                                                                                                                      property name

                                                                                                                                                                                      name: S | undefined;

                                                                                                                                                                                        property path

                                                                                                                                                                                        path: S[];

                                                                                                                                                                                          property properties

                                                                                                                                                                                          properties?: MockjsToJSONSchemaRs[] | undefined;

                                                                                                                                                                                            property rule

                                                                                                                                                                                            rule: object;

                                                                                                                                                                                              property template

                                                                                                                                                                                              template: any;

                                                                                                                                                                                                property type

                                                                                                                                                                                                type: S;

                                                                                                                                                                                                  interface MockjsValidRsItem

                                                                                                                                                                                                  interface MockjsValidRsItem {}

                                                                                                                                                                                                    property action

                                                                                                                                                                                                    action: S;

                                                                                                                                                                                                      property actual

                                                                                                                                                                                                      actual: S;

                                                                                                                                                                                                        property expected

                                                                                                                                                                                                        expected: S;

                                                                                                                                                                                                          property message

                                                                                                                                                                                                          message: S;

                                                                                                                                                                                                            property path

                                                                                                                                                                                                            path: S[];

                                                                                                                                                                                                              property type

                                                                                                                                                                                                              type: S;

                                                                                                                                                                                                                Type Aliases

                                                                                                                                                                                                                type B

                                                                                                                                                                                                                type B = boolean;

                                                                                                                                                                                                                  type MockjsSetup

                                                                                                                                                                                                                  type MockjsSetup = (settings: MockjsSetupSettings) => void;

                                                                                                                                                                                                                    type MockjsToJSONSchema

                                                                                                                                                                                                                    type MockjsToJSONSchema = (template: any) => MockjsToJSONSchemaRs;

                                                                                                                                                                                                                      type MockjsValid

                                                                                                                                                                                                                      type MockjsValid = (template: any, data: any) => MockjsValidRsItem[];

                                                                                                                                                                                                                        type N

                                                                                                                                                                                                                        type N = number;

                                                                                                                                                                                                                          type RandomDateUtilString

                                                                                                                                                                                                                          type RandomDateUtilString =
                                                                                                                                                                                                                          | 'year'
                                                                                                                                                                                                                          | 'month'
                                                                                                                                                                                                                          | 'week'
                                                                                                                                                                                                                          | 'day'
                                                                                                                                                                                                                          | 'hour'
                                                                                                                                                                                                                          | 'minute'
                                                                                                                                                                                                                          | 'second'
                                                                                                                                                                                                                          | 'week';

                                                                                                                                                                                                                            type RandomImageFormatString

                                                                                                                                                                                                                            type RandomImageFormatString = 'png' | 'gif' | 'jpg';

                                                                                                                                                                                                                              type RandomWebProtocal

                                                                                                                                                                                                                              type RandomWebProtocal =
                                                                                                                                                                                                                              | 'http'
                                                                                                                                                                                                                              | 'ftp'
                                                                                                                                                                                                                              | 'gopher'
                                                                                                                                                                                                                              | 'mailto'
                                                                                                                                                                                                                              | 'mid'
                                                                                                                                                                                                                              | 'cid'
                                                                                                                                                                                                                              | 'news'
                                                                                                                                                                                                                              | 'nntp'
                                                                                                                                                                                                                              | 'prospero'
                                                                                                                                                                                                                              | 'telnet'
                                                                                                                                                                                                                              | 'rlogin'
                                                                                                                                                                                                                              | 'tn3270'
                                                                                                                                                                                                                              | 'wais';

                                                                                                                                                                                                                                type S

                                                                                                                                                                                                                                type S = string;

                                                                                                                                                                                                                                  type templateOrFn

                                                                                                                                                                                                                                  type templateOrFn = ((options: MockjsRequestOptions) => any) | object;

                                                                                                                                                                                                                                    Package Files (1)

                                                                                                                                                                                                                                    Dependencies (0)

                                                                                                                                                                                                                                    No dependencies.

                                                                                                                                                                                                                                    Dev Dependencies (0)

                                                                                                                                                                                                                                    No dev dependencies.

                                                                                                                                                                                                                                    Peer Dependencies (0)

                                                                                                                                                                                                                                    No peer dependencies.

                                                                                                                                                                                                                                    Badge

                                                                                                                                                                                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/mockjs.

                                                                                                                                                                                                                                    • Markdown
                                                                                                                                                                                                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/mockjs)
                                                                                                                                                                                                                                    • HTML
                                                                                                                                                                                                                                      <a href="https://www.jsdocs.io/package/@types/mockjs"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>