import { SpokAssertions } from './types'; declare class SpokAssertionsClass implements SpokAssertions { /** * Specifies that the given number is within the given range, * i.e. `min<= x <=max`. * * ```js * var spec = { * x: spok.range(1, 2) // specifies that x should be >=1 and <=2 * } * ``` * * @function * @param {Number} min minimum * @param {Number} max maximum */ range: (min: number, max: number) => { (x: number): boolean; $spec: string; $description: string; }; /** * Specifies that a number is greater than the given criteria. * * ```js * var spec = { * x: spok.gt(1) // specifies that x should be >1 * } * ``` * * @function * @param {Number} n criteria */ gt: (n: number) => { (x: number): boolean; $spec: string; $description: string; }; /** * Specififies that a number is greater or equal the given criteria. * * ```js * var spec = { * x: spok.ge(1) // specifies that x should be >=1 * } * ``` * * @function * @param {Number} n criteria */ ge: (n: number) => { (x: number): boolean; $spec: string; $description: string; }; /** * Specififies that a number is less than the given criteria. * * ```js * var spec = { * x: spok.lt(1) // specifies that x should be < 1 * } * ``` * * @function * @param {Number} n criteria */ lt: (n: number) => { (x: number): boolean; $spec: string; $description: string; }; /** * Specififies that a number is less or equal the given criteria. * * ```js * var spec = { * x: spok.le(1) // specifies that x should be <=1 * } * ``` * * @function * @param {Number} n criteria */ le: (n: number) => { (x: number): boolean; $spec: string; $description: string; }; /** * Specifies that the value is not equal another. * * ```js * var spec = { * x: spok.ne(undefined) // specifies that x should be defined * } * ``` * * @function * @param {unknown} value criteria */ ne: (value: unknown) => { (x: unknown): boolean; $spec: string; $description: string; }; /** * Specifies that the value is greater than zero * * ```js * var spec = { * x: spok.gtz * } * ``` * @function */ get gtz(): { (x: number): boolean; $spec: string; $description: string; }; /** * Specifies that the value is greater or equal zero * * ```js * var spec = { * x: spok.gez * } * ``` * @function */ get gez(): { (x: number): boolean; $spec: string; $description: string; }; /** * Specifies that the value is less than zero * * ```js * var spec = { * x: spok.ltz * } * ``` * @function */ get ltz(): { (x: number): boolean; $spec: string; $description: string; }; /** * Specifies that the value is less or equal zero * * ```js * var spec = { * x: spok.lez * } * ``` * @function */ get lez(): { (x: number): boolean; $spec: string; $description: string; }; /** * Specifies that the input is of a given type. * * ```js * var spec = { * x: spok.type('number') // specifies that x should be a Number * } * ``` * * @function * @param {String} t expected type */ type: (t: string) => { (x: unknown): boolean; $spec: string; $description: string; }; /** * Specifies that the input is an array. * * ```js * var spec = { * x: spok.array // specifies that x should be an Array * } * ``` * * @function */ get array(): { (x: unknown[]): boolean; $spec: string; $description: string; }; /** * Specifies that the input is an array with a specific number of elements * * var spec = { * // specifies that x should be an Array with 2 elements * x: spok.arrayElements(2) * } * * @function * @param {Number} n number of elements */ arrayElements: (n: number) => { (array: unknown[]): boolean; $spec: string; $description: string; }; /** * Specifies that the input is an array with a number of elements * in a given range * * var spec = { * // specifies that x should be an Array with 2-4 elements * x: spok.arrayElementsRange(2, 4) * } * * @function * @param {Number} min min number of elements * @param {Number} max max number of elements */ arrayElementsRange: (min: number, max: number) => { (array: unknown[]): boolean; $spec: string; $description: string; }; /** * Specifies that the input of type number and `isNaN(x)` returns `false`. * * ```js * var spec = { * x: spok.number // specifies that x should be a Number * } * ``` * * @function */ get number(): { (x: unknown): boolean; $spec: string; $description: string; }; /** * Specifies that the input is a string. * * ``` * var spec = { * x: spok.string // specifies that x should be a String * } * ``` * * @function */ get string(): { (x: unknown): boolean; $spec: string; $description: string; }; /** * Specifies that the input is a function. * * ``` * var spec = { * x: spok.function // specifies that x should be a function * } * ``` * * @function */ get function(): { (x: unknown): boolean; $spec: string; $description: string; }; /** * Specifies that the input is an object and it is not `null`. * * ```js * var spec = { * x: spok.definedObject // specifies that x is a non-null object * } * ``` * * @function */ get definedObject(): { (x: unknown): boolean; $spec: string; $description: string; }; /** * Specifies that the string starts with the specified substring. * * **NOTE**: only available with node.js which has an ES6 `startsWith` function * * ```js * var spec = { * x: spok.startsWith('hello') // specifies that x should start with 'hello' * } * ``` * * @function * @param {String} what substring the given string should start with */ startsWith: (what: string) => { (x: string): boolean; $spec: string; $description: string; }; /** * Specifies that the string ends with the specified substring. * * **NOTE**: only available with node.js which has an ES6 `endsWith` function * * ```js * var spec = { * x: spok.endsWith('hello') // specifies that x should start with 'hello' * } * ``` * * @function * @param {String} what substring the given string should start with */ endsWith: (what: string) => { (x: string): boolean; $spec: string; $description: string; }; /** * Specifies that the string needs to match the given regular expression. * * ```js * var spec = { * // specifies that x should match /hello$/ * x: spok.test(/hello$/) * } * ``` * * @function * @param {RegExp} regex regular expression against * which the string is checked via `test` */ test: (regex: RegExp) => { (x: string): boolean; $spec: string; $description: string; }; /** * Specifies that a value is defined, * i.e. it is neither `null` nor `undefined`. * * ```js * var spec = { * x: spok.defined * } * ``` * * @function */ get defined(): { (x: unknown): boolean; $spec: string; $description: string; }; /** * Specifies that a value is notDefined, * i.e. it is either `null` or `notDefined`. * * ```js * var spec = { * x: spok.notDefined * } * ``` * * @function */ get notDefined(): { (x: unknown): boolean; $spec: string; $description: string; }; } declare const spokAssertions: SpokAssertionsClass & { gtz: { (x: number): boolean; $spec: string; $description: string; }; gez: { (x: number): boolean; $spec: string; $description: string; }; ltz: { (x: number): boolean; $spec: string; $description: string; }; lez: { (x: number): boolean; $spec: string; $description: string; }; array: { (x: unknown[]): boolean; $spec: string; $description: string; }; number: { (x: unknown): boolean; $spec: string; $description: string; }; string: { (x: unknown): boolean; $spec: string; $description: string; }; function: { (x: unknown): boolean; $spec: string; $description: string; }; definedObject: { (x: unknown): boolean; $spec: string; $description: string; }; defined: { (x: unknown): boolean; $spec: string; $description: string; }; notDefined: { (x: unknown): boolean; $spec: string; $description: string; }; }; export default spokAssertions; //# sourceMappingURL=spok-assertions.d.ts.map