1.0 KiB
1.0 KiB
Overview | Installation | Usage | Types | Values | Syntax | TypeRegistry | TypeCheck
Parse
Use the Parse function to parse a value. This function calls the Clone Clean, Default, Convert, Assert and Decode Value functions in this exact order to process a value.
const R = Value.Parse(Type.String(), "hello"); // const R: string = "hello"
const E = Value.Parse(Type.String(), undefined); // throws AssertError
You can override the order in which functions are run, or omit functions entirely using the following.
// Runs no functions.
const R = Value.Parse([], Type.String(), 12345);
// Runs the Assert() function.
const E = Value.Parse(["Assert"], Type.String(), 12345);
// Runs the Convert() function followed by the Assert() function.
const S = Value.Parse(["Convert", "Assert"], Type.String(), 12345);
Back to Home