Home Reference Source Test

References

summary
public

The TinyType abstract class should be used as a base class for your own Tiny Types.

public

F TinyTypeOf(): *

this function is experimental.

The TinyTypeOf can be used to define simple single-value TinyTypes on a single line.

public

F ensure(name: string, value: T, predicates: ...Array<Predicate<T>>): T

The ensure function verifies if the value meets the specified {Predicate}s.

public

F match(value: *): PatternMatcher<any, any, any, any>

this function is experimental.
public

V check: *

this variable was deprecated.

This function has been deprecated.

objects

summary
public

F deprecated(message: string, log: Logger): *

A decorator to mark a class, method or function as deprecated and make it log a warning whenever it is used.

public

F isRecord(value: unknown): boolean

public

F toJSON(value: undefined): *

Serialises the object to a JSON representation.

predicates

summary
public
public

Describes a Condition that the value should meet.

public

C Result

public
public

F and(predicates: ...Array<Predicate<T>>): Predicate<T>

Ensures that the value meets all the provided Predicates.

public

Ensures that the value ends with a given suffix.

public

F hasLengthOf(expectedLength: number): Predicate

Ensures that the value is of expectedLength.

public

F isArray(): Predicate<T[]>

Ensures that the value is an Array.

public

Ensures that the value is a Boolean value.

public

Ensures that the value is defined as anything other than null or undefined.

public

F isEqualTo(expectedValue: string | number | symbol | TinyType | object): Predicate<any>

Ensures that the value is equal to expectedValue.

public

Ensures that the value is a Function.

public

Ensures that the value is greater than the lowerBound.

public

Ensures that the value is greater than or equal to the lowerBound.

public

F isInRange(lowerBound: number, upperBound: number): Predicate<number>

Ensures that the value is greater than or equal to the lowerBound and less than or equal to the upperBound

public

F isInstanceOf(type: Constructor<T>): Predicate<T>

Ensures that the value is an instance of type

public

Ensures that the value is an integer Number.

public

F isLessThan(upperBound: number): Predicate<number>

Ensures that the value is less than the upperBound.

public

Ensures that the value is less than or equal to the upperBound.

public

Ensures that the value is not an empty string.

public

Ensures that the value is a Number.

public

F isOneOf(allowedValues: ...T[]): Predicate<T>

Ensures that the value is equal to one of the allowedValues

public

Ensures that the value is a plain Object.

public

Ensures that the value is a String.

public

F matches(expression: RegExp): Predicate<string>

Ensures that the value matches RegExp.

public

F or(predicates: Predicate<T>): Predicate<T>

Ensures that the value meets at least one of the provided Predicates.

public

F property(propertyName: *, predicates: ...*): Predicate<T>

Ensures that the property of the value meets the predicates

public

Ensures that the value starts with a given prefix.

Directories