aiparking_api/node_modules/ow/dist/lib/predicates/array.d.ts
2020-02-02 15:24:30 +07:00

70 lines
2.2 KiB
TypeScript

import { Predicate, Context } from './predicate';
export declare class ArrayPredicate<T = any> extends Predicate<T[]> {
/**
* @hidden
*/
constructor(context?: Context<T[]>);
/**
* Test an array to have a specific length.
*
* @param length The length of the array.
*/
length(length: number): this;
/**
* Test an array to have a minimum length.
*
* @param length The minimum length of the array.
*/
minLength(length: number): this;
/**
* Test an array to have a maximum length.
*
* @param length The maximum length of the array.
*/
maxLength(length: number): this;
/**
* Test an array to start with a specific value. The value is tested by identity, not structure.
*
* @param searchElement The value that should be the start of the array.
*/
startsWith(searchElement: T): this;
/**
* Test an array to end with a specific value. The value is tested by identity, not structure.
*
* @param searchElement The value that should be the end of the array.
*/
endsWith(searchElement: T): this;
/**
* Test an array to include all the provided elements. The values are tested by identity, not structure.
*
* @param searchElements The values that should be included in the array.
*/
includes(...searchElements: T[]): this;
/**
* Test an array to include any of the provided elements. The values are tested by identity, not structure.
*
* @param searchElements The values that should be included in the array.
*/
includesAny(...searchElements: T[]): this;
/**
* Test an array to be empty.
*/
readonly empty: this;
/**
* Test an array to be not empty.
*/
readonly nonEmpty: this;
/**
* Test an array to be deeply equal to the provided array.
*
* @param expected Expected value to match.
*/
deepEqual(expected: T[]): this;
/**
* Test all elements in the array to match to provided predicate.
*
* @param predicate The predicate that should be applied against every individual item.
*/
ofType(predicate: Predicate<T>): this;
}