1 | import { Predicate } from './predicates/predicate';
|
2 | import { BasePredicate } from './predicates/base-predicate';
|
3 | import { Modifiers } from './modifiers';
|
4 | import { Predicates } from './predicates';
|
5 |
|
6 |
|
7 |
|
8 | export declare type Main = <T>(value: T, label: string | Function, predicate: BasePredicate<T>, stack: string) => void;
|
9 | export interface Ow extends Modifiers, Predicates {
|
10 | |
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | isValid: <T>(value: T, predicate: BasePredicate<T>) => value is T;
|
17 | |
18 |
|
19 |
|
20 |
|
21 |
|
22 | create: (<T>(predicate: BasePredicate<T>) => ReusableValidator<T>) & (<T>(label: string, predicate: BasePredicate<T>) => ReusableValidator<T>);
|
23 | /**
|
24 | Test if the value matches the predicate. Throws an `ArgumentError` if the test fails.
|
25 |
|
26 | @param value - Value to test.
|
27 | @param predicate - Predicate to test against.
|
28 | */
|
29 | <T>(value: unknown, predicate: BasePredicate<T>): asserts value is T;
|
30 | /**
|
31 | Test if `value` matches the provided `predicate`. Throws an `ArgumentError` with the specified `label` if the test fails.
|
32 |
|
33 | @param value - Value to test.
|
34 | @param label - Label which should be used in error messages.
|
35 | @param predicate - Predicate to test against.
|
36 | */
|
37 | <T>(value: unknown, label: string, predicate: BasePredicate<T>): asserts value is T;
|
38 | }
|
39 | /**
|
40 | A reusable validator.
|
41 | */
|
42 | export interface ReusableValidator<T> {
|
43 | /**
|
44 | Test if the value matches the predicate. Throws an `ArgumentError` if the test fails.
|
45 |
|
46 | @param value - Value to test.
|
47 | @param label - Override the label which should be used in error messages.
|
48 | */
|
49 | (value: T, label?: string): void;
|
50 | }
|
51 | declare const _ow: Ow;
|
52 | export default _ow;
|
53 | export { BasePredicate, Predicate };
|
54 | export { StringPredicate, NumberPredicate, BooleanPredicate, ArrayPredicate, ObjectPredicate, DatePredicate, ErrorPredicate, MapPredicate, WeakMapPredicate, SetPredicate, WeakSetPredicate, TypedArrayPredicate, ArrayBufferPredicate, DataViewPredicate, AnyPredicate, Shape } from './predicates';
|
55 | export { ArgumentError } from './argument-error';
|
56 |
|
\ | No newline at end of file |