Skip to main content
Module

x/typestruct/mod.ts

Composable and checkable JavaScript (and TypeScript) data structure
Latest
import * as typestruct from "https://deno.land/x/typestruct@1.0.0-beta.5/mod.ts";

Functions

Create intersection struct. Ensure all structures satisfy.

Create Array data type struct.

Assert value with checkable.

Create bigint data type struct.

Create boolean data type struct.

Create empty struct. Empty means there are no elements.

Create function data type struct.

Create instanceof struct. Ensure that the input is an instance of a defined constructor.

Create integer struct. Ensure the input is integer.

Whether the input satisfies struct or not. With type guard, inputs are type inferred.

Create list struct. List is array subtype. Ensure that all elements are same type.

Create maximum struct. Ensure the input less than or equal to threshold.

Create max size struct. Sets the maximum number of elements.

Create minimum struct. Ensure the input grater than or equal to threshold.

Create min size struct. Sets the minimum number of elements.

Create NaN struct. Ensure the input is NaN.

Create negative number struct. Ensure the input is negative number. Negative number means a number less than zero.

Create non empty struct. Non empty meas there are more than one element.

Create negative value struct. Ensure the input is non-negative number. Non-negative number means greater than or equal to zero.

Create non-positive value struct. Ensure the input is non-positive number. Non-positive number means less than or equal to zero.

Create inversion struct. Ensure the structure is not satisfied.

Create nullable struct. Add null tolerance to struct.

Create number data type struct.

Create object literal struct. Additional properties will ignore.

Create Omit struct. From struct, omit a set of properties whose keys are in the definition.

Create optional struct. Add undefined tolerance to struct.

Create union struct.

Create Partial struct. Make all properties in struct optional.

Create pattern struct. Ensure the input match to the pattern.

Create Pick struct. From struct, pick a set of properties whose keys are in the definition.

Create positive number struct. Ensure the input is positive number. Positive number means greater than zero.

Create Record struct. Ensure the input is object, and keys and values satisfy struct.

Create size struct. Ensure the number of elements.

Create string data type struct.

Create symbol data type struct.

Create tuple struct. Tuple is array subtype. Ensure that the position and type of the elements match.

Returns the checking result. If input satisfies struct, the valid field is true and returns an object with type-inferred data. Otherwise, the valid field is false and returns an object containing the errors field.

Create valid date struct. Ensure the input is valid date (non NaN) format.

Create primitive value struct.

Interfaces

Checkable API.

Struct check options.

Context of constructor.

Context of data type.

Intersection type API.

Dynamic messenger API.

String Convertible API.

Dada struct API.

Union type API.

Wrapper container API.

Type Aliases

JavaScript data type. null is not object.

Validate result.