first commit

This commit is contained in:
2020-02-02 15:24:30 +07:00
commit 61dfa00b20
2410 changed files with 152621 additions and 0 deletions

11
node_modules/ow/dist/lib/predicates/any.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import { Predicate } from './predicate';
import { BasePredicate, testSymbol } from './base-predicate';
import { Ow } from '../..';
/**
* @hidden
*/
export declare class AnyPredicate<T> implements BasePredicate<T> {
private readonly predicates;
constructor(predicates: Predicate[]);
[testSymbol](value: T, main: Ow): void;
}

69
node_modules/ow/dist/lib/predicates/array.d.ts generated vendored Normal file
View File

@@ -0,0 +1,69 @@
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;
}

View File

@@ -0,0 +1,11 @@
import { Ow } from '../..';
/**
* @hidden
*/
export declare const testSymbol: unique symbol;
/**
* @hidden
*/
export interface BasePredicate<T = any> {
[testSymbol](value: T, main: Ow): void;
}

15
node_modules/ow/dist/lib/predicates/boolean.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import { Predicate, Context } from './predicate';
export declare class BooleanPredicate extends Predicate<boolean> {
/**
* @hidden
*/
constructor(context?: Context<boolean>);
/**
* Test a boolean to be true.
*/
readonly true: this;
/**
* Test a boolean to be false.
*/
readonly false: this;
}

19
node_modules/ow/dist/lib/predicates/date.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import { Predicate, Context } from './predicate';
export declare class DatePredicate extends Predicate<Date> {
/**
* @hidden
*/
constructor(context?: Context<Date>);
/**
* Test a date to be before another date.
*
* @param date Maximum value.
*/
before(date: Date): this;
/**
* Test a date to be before another date.
*
* @param date Minimum value.
*/
after(date: Date): this;
}

61
node_modules/ow/dist/lib/predicates/error.d.ts generated vendored Normal file
View File

@@ -0,0 +1,61 @@
import { Predicate, Context } from './predicate';
export declare class ErrorPredicate extends Predicate<Error> {
/**
* @hidden
*/
constructor(context?: Context<Error>);
/**
* Test an error to have a specific name.
*
* @param expected Expected name of the Error.
*/
name(expected: string): this;
/**
* Test an error to have a specific message.
*
* @param expected Expected message of the Error.
*/
message(expected: string): this;
/**
* Test the error message to include a specific message.
*
* @param message Message that should be included in the error.
*/
messageIncludes(message: string): this;
/**
* Test the error object to have specific keys.
*
* @param keys One or more keys which should be part of the error object.
*/
hasKeys(...keys: string[]): this;
/**
* Test an error to be of a specific instance type.
*
* @param instance The expected instance type of the error.
*/
instanceOf(instance: any): this;
/**
* Test an Error to be a TypeError.
*/
readonly typeError: this;
/**
* Test an Error to be an EvalError.
*/
readonly evalError: this;
/**
* Test an Error to be a RangeError.
*/
readonly rangeError: this;
/**
* Test an Error to be a ReferenceError.
*/
readonly referenceError: this;
/**
* Test an Error to be a SyntaxError.
*/
readonly syntaxError: this;
/**
* Test an Error to be a URIError.
*/
readonly uriError: this;
}

75
node_modules/ow/dist/lib/predicates/map.d.ts generated vendored Normal file
View File

@@ -0,0 +1,75 @@
import { Predicate, Context } from './predicate';
export declare class MapPredicate<T1 = any, T2 = any> extends Predicate<Map<T1, T2>> {
/**
* @hidden
*/
constructor(context?: Context<Map<T1, T2>>);
/**
* Test a Map to have a specific size.
*
* @param size The size of the Map.
*/
size(size: number): this;
/**
* Test an Map to have a minimum size.
*
* @param size The minimum size of the Map.
*/
minSize(size: number): this;
/**
* Test an Map to have a maximum size.
*
* @param size The maximum size of the Map.
*/
maxSize(size: number): this;
/**
* Test a Map to include all the provided keys. The keys are tested by identity, not structure.
*
* @param keys The keys that should be a key in the Map.
*/
hasKeys(...keys: T1[]): this;
/**
* Test a Map to include any of the provided keys. The keys are tested by identity, not structure.
*
* @param keys The keys that could be a key in the Map.
*/
hasAnyKeys(...keys: T1[]): this;
/**
* Test a Map to include all the provided values. The values are tested by identity, not structure.
*
* @param values The values that should be a value in the Map.
*/
hasValues(...values: T2[]): this;
/**
* Test a Map to include any of the provided values. The values are tested by identity, not structure.
*
* @param values The values that could be a value in the Map.
*/
hasAnyValues(...values: T2[]): this;
/**
* Test all the keys in the Map to match the provided predicate.
*
* @param predicate The predicate that should be applied against every key in the Map.
*/
keysOfType(predicate: Predicate<T1>): this;
/**
* Test all the values in the Map to match the provided predicate.
*
* @param predicate The predicate that should be applied against every value in the Map.
*/
valuesOfType(predicate: Predicate<T2>): this;
/**
* Test a Map to be empty.
*/
readonly empty: this;
/**
* Test a Map to be not empty.
*/
readonly nonEmpty: this;
/**
* Test a Map to be deeply equal to the provided Map.
*
* @param expected Expected Map to match.
*/
deepEqual(expected: Map<T1, T2>): this;
}

64
node_modules/ow/dist/lib/predicates/number.d.ts generated vendored Normal file
View File

@@ -0,0 +1,64 @@
import { Predicate, Context } from './predicate';
export declare class NumberPredicate extends Predicate<number> {
/**
* @hidden
*/
constructor(context?: Context<number>);
/**
* Test a number to be in a specified range.
*
* @param start Start of the range.
* @param end End of the range.
*/
inRange(start: number, end: number): this;
/**
* Test a number to be greater than the provided value.
*
* @param x Minimum value.
*/
greaterThan(x: number): this;
/**
* Test a number to be greater than or equal to the provided value.
*
* @param x Minimum value.
*/
greaterThanOrEqual(x: number): this;
/**
* Test a number to be less than the provided value.
*
* @param x Maximum value.
*/
lessThan(x: number): this;
/**
* Test a number to be less than or equal to the provided value.
*
* @param x Minimum value.
*/
lessThanOrEqual(x: number): this;
/**
* Test a number to be equal to a specified number.
*
* @param expected Expected value to match.
*/
equal(expected: number): this;
/**
* Test a number to be an integer.
*/
readonly integer: this;
/**
* Test a number to be finite.
*/
readonly finite: this;
/**
* Test a number to be infinite.
*/
readonly infinite: this;
/**
* Test a number to be positive.
*/
readonly positive: this;
/**
* Test a number to be negative.
*/
readonly negative: this;
}

55
node_modules/ow/dist/lib/predicates/object.d.ts generated vendored Normal file
View File

@@ -0,0 +1,55 @@
import { Predicate, Context } from './predicate';
export declare class ObjectPredicate extends Predicate<object> {
/**
* @hidden
*/
constructor(context?: Context<object>);
/**
* Test if an Object is a plain object.
*/
readonly plain: this;
/**
* Test an object to be empty.
*/
readonly empty: this;
/**
* Test an object to be not empty.
*/
readonly nonEmpty: this;
/**
* Test all the values in the object to match the provided predicate.
*
* @param predicate The predicate that should be applied against every value in the object.
*/
valuesOfType<T>(predicate: Predicate<T>): this;
/**
* Test all the values in the object deeply to match the provided predicate.
*
* @param predicate The predicate that should be applied against every value in the object.
*/
deepValuesOfType<T>(predicate: Predicate<T>): this;
/**
* Test an object to be deeply equal to the provided object.
*
* @param expected Expected object to match.
*/
deepEqual(expected: object): this;
/**
* Test an object to be of a specific instance type.
*
* @param instance The expected instance type of the object.
*/
instanceOf(instance: any): this;
/**
* Test an object to include all the provided keys. You can use [dot-notation](https://github.com/sindresorhus/dot-prop) in a key to access nested properties.
*
* @param keys The keys that should be present in the object.
*/
hasKeys(...keys: string[]): this;
/**
* Test an object to include any of the provided keys. You can use [dot-notation](https://github.com/sindresorhus/dot-prop) in a key to access nested properties.
*
* @param keys The keys that could be a key in the object.
*/
hasAnyKeys(...keys: string[]): this;
}

54
node_modules/ow/dist/lib/predicates/predicate.d.ts generated vendored Normal file
View File

@@ -0,0 +1,54 @@
import { Ow } from '../..';
import { BasePredicate, testSymbol } from './base-predicate';
/**
* @hidden
*/
export interface Validator<T> {
message(value: T, label?: string, result?: any): string;
validator(value: T): any;
}
/**
* @hidden
*/
export interface Context<T> {
validators: Validator<T>[];
label?: string;
}
/**
* @hidden
*/
export declare const validatorSymbol: unique symbol;
/**
* @hidden
*/
export declare class Predicate<T = any> implements BasePredicate<T> {
private readonly type;
private readonly context;
constructor(type: string, context?: Context<T>);
/**
* @hidden
*/
[testSymbol](value: T, main: Ow): void;
/**
* @hidden
*/
readonly [validatorSymbol]: Validator<T>[];
/**
* Invert the following validators.
*/
readonly not: this;
/**
* Assign a label to this predicate for use in error messages.
*
* @param value Label to assign.
*/
label(value: string): this;
/**
* Test if the value matches a custom validation function. The validation function should return `true` if the value
* passes the function. If the function either returns `false` or a string, the function fails and the string will be
* used as error message.
*
* @param fn Validation function.
*/
is(fn: (value: T) => boolean | string): this;
}

57
node_modules/ow/dist/lib/predicates/set.d.ts generated vendored Normal file
View File

@@ -0,0 +1,57 @@
import { Predicate, Context } from './predicate';
export declare class SetPredicate<T = any> extends Predicate<Set<T>> {
/**
* @hidden
*/
constructor(context?: Context<Set<T>>);
/**
* Test a Set to have a specific size.
*
* @param size The size of the Set.
*/
size(size: number): this;
/**
* Test an Size to have a minimum size.
*
* @param size The minimum size of the Set.
*/
minSize(size: number): this;
/**
* Test an Set to have a maximum size.
*
* @param size The maximum size of the Set.
*/
maxSize(size: number): this;
/**
* Test a Set to include all the provided items. The items are tested by identity, not structure.
*
* @param items The items that should be a item in the Set.
*/
has(...items: T[]): this;
/**
* Test a Set to include any of the provided items. The items are tested by identity, not structure.
*
* @param items The items that could be a item in the Set.
*/
hasAny(...items: T[]): this;
/**
* Test all the items in the Set to match the provided predicate.
*
* @param predicate The predicate that should be applied against every item in the Set.
*/
ofType(predicate: Predicate<T>): this;
/**
* Test a Set to be empty.
*/
readonly empty: this;
/**
* Test a Set to be not empty.
*/
readonly nonEmpty: this;
/**
* Test a Set to be deeply equal to the provided Set.
*
* @param expected Expected Set to match.
*/
deepEqual(expected: Set<T>): this;
}

75
node_modules/ow/dist/lib/predicates/string.d.ts generated vendored Normal file
View File

@@ -0,0 +1,75 @@
import { Predicate, Context } from './predicate';
export declare class StringPredicate extends Predicate<string> {
/**
* @hidden
*/
constructor(context?: Context<string>);
/**
* Test a string to have a specific length.
*
* @param length The length of the string.
*/
length(length: number): this;
/**
* Test a string to have a minimum length.
*
* @param length The minimum length of the string.
*/
minLength(length: number): this;
/**
* Test a string to have a maximum length.
*
* @param length The maximum length of the string.
*/
maxLength(length: number): this;
/**
* Test a string against a regular expression.
*
* @param regeExp The regular expression to match the value with.
*/
matches(regExp: RegExp): this;
/**
* Test a string to start with a specific value.
*
* @param searchString The value that should be the start of the string.
*/
startsWith(searchString: string): this;
/**
* Test a string to end with a specific value.
*
* @param searchString The value that should be the end of the string.
*/
endsWith(searchString: string): this;
/**
* Test a string to include a specific value.
*
* @param searchString The value that should be included in the string.
*/
includes(searchString: string): this;
/**
* Test a string to be empty.
*/
readonly empty: this;
/**
* Test a string to be not empty.
*/
readonly nonEmpty: this;
/**
* Test a string to be equal to a specified string.
*
* @param expected Expected value to match.
*/
equals(expected: string): this;
/**
* Test a string to be alphanumeric.
*/
readonly alphanumeric: this;
/**
* Test a string to be numeric.
*/
readonly numeric: this;
/**
* Test a string to be a valid date.
*/
readonly date: this;
}

19
node_modules/ow/dist/lib/predicates/weak-map.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import { Predicate, Context } from './predicate';
export declare class WeakMapPredicate<T1 extends object = any, T2 = any> extends Predicate<WeakMap<T1, T2>> {
/**
* @hidden
*/
constructor(context?: Context<WeakMap<T1, T2>>);
/**
* Test a WeakMap to include all the provided keys. The keys are tested by identity, not structure.
*
* @param keys The keys that should be a key in the WeakMap.
*/
hasKeys(...keys: T1[]): this;
/**
* Test a WeakMap to include any of the provided keys. The keys are tested by identity, not structure.
*
* @param keys The keys that could be a key in the WeakMap.
*/
hasAnyKeys(...keys: T1[]): this;
}

19
node_modules/ow/dist/lib/predicates/weak-set.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import { Predicate, Context } from './predicate';
export declare class WeakSetPredicate<T extends object = any> extends Predicate<WeakSet<T>> {
/**
* @hidden
*/
constructor(context?: Context<WeakSet<T>>);
/**
* Test a WeakSet to include all the provided items. The items are tested by identity, not structure.
*
* @param items The items that should be a item in the WeakSet.
*/
has(...items: T[]): this;
/**
* Test a WeakSet to include any of the provided items. The items are tested by identity, not structure.
*
* @param items The items that could be a item in the WeakSet.
*/
hasAny(...items: T[]): this;
}