self-assert
Version:
A small TypeScript library for designing models with built-in validity.
69 lines • 2.88 kB
TypeScript
import type { Predicate } from "../Requirements";
export declare class ListsRequirements {
/**
* Returns a predicate that holds when the list has exactly the given number of elements
* @function @category Lists
*/
static hasExactly: (aNumber: number) => (list: ArrayLike<unknown>) => boolean;
/**
* Returns a predicate that holds when the list has no elements
* @function @category Lists
*/
static isEmpty: Predicate<ArrayLike<unknown>>;
/**
* Returns a predicate that holds when the list has at least one element
* @function @category Lists
*/
static isNotEmpty: Predicate<ArrayLike<unknown>>;
/**
* Returns a predicate that holds when the list has more than the given number of elements
* @function @category Lists
*/
static hasMoreThan: (aNumber: number) => (list: ArrayLike<unknown>) => boolean;
/**
* Returns a predicate that holds when the list has at most the given number of elements
* @function @category Lists
*/
static hasAtMost: (aNumber: number) => Predicate<ArrayLike<unknown>>;
/**
* Returns a predicate that holds when the list has less than the given number of elements
* @function @category Lists
*/
static hasLessThan: (aNumber: number) => Predicate<ArrayLike<unknown>>;
/**
* Returns a predicate that holds when the list has at least the given number of elements
* @function @category Lists
*/
static hasAtLeast: (aNumber: number) => Predicate<ArrayLike<unknown>>;
/**
* Returns a predicate that holds when the list contains the given element
* @function @category Lists
*/
static includes: <ElementType>(element: ElementType) => Predicate<{
includes: Predicate<ElementType>;
}>;
/**
* Opposite of {@link includes}
* @function @category Lists
*/
static doesNotInclude: <ElementType>(element: ElementType) => Predicate<{
includes: Predicate<ElementType>;
}>;
/**
* Returns a predicate that holds when all elements of the list satisfy the given condition
* @function @category Lists
*/
static allSatisfy: <ElementType>(predicate: Predicate<ElementType>) => (list: Iterable<ElementType>) => boolean;
/**
* Returns a predicate that holds when any element of the list satisfies the given condition
* @function @category Lists
*/
static anySatisfy: <ElementType>(predicate: Predicate<ElementType>) => (list: Iterable<ElementType>) => boolean;
/**
* Returns a predicate that holds when no element of the list satisfies the given condition.
* Opposite of {@link anySatisfy}
* @function @category Lists
*/
static noneSatisfy: <ElementType>(predicate: Predicate<ElementType>) => Predicate<Iterable<ElementType>>;
}
//# sourceMappingURL=ListsRequirements.d.ts.map