From 297ddd9d3d095785fa4b0ecd8d44e9733a98d43e Mon Sep 17 00:00:00 2001 From: sinclair Date: Tue, 26 Nov 2024 19:22:10 +0900 Subject: [PATCH] Documentation --- readme.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 74b975cc..338e8f41 100644 --- a/readme.md +++ b/readme.md @@ -1325,7 +1325,7 @@ const B = Value.Encode(Type.String(), 42) // throw ### Parse -Use the Parse function to process a value. The Parse function will call a specific sequence of Value functions (operations) to process the value. +Use the Parse function to parse a value. This function calls the Value functions `Clone` `Clean`, `Default`, `Convert`, `Assert` and `Decode` in this order to process a value. ```typescript const R = Value.Parse(Type.String(), 'hello') // const R: string = "hello" @@ -1333,18 +1333,21 @@ const R = Value.Parse(Type.String(), 'hello') // const R: string = "hello" const E = Value.Parse(Type.String(), undefined) // throws AssertError ``` -The specific sequence of Value operations is `Clone` `Clean`, `Default`, `Convert`, `Assert` and `Decode`. You can specify user defined sequences in the following way. +You can override the order in which functions are are run, or omit function calls entirely in the following way. ```typescript -// Same as calling the Assert() function +// Runs no functions. + +const R = Value.Parse([], Type.String(), 12345) + +// Runs the Assert() function. const E = Value.Parse(['Assert'], Type.String(), 12345) -// Same as calling the Convert() then Assert() functions. +// Runs the Convert() function followed by the Assert() function. const S = Value.Parse(['Convert', 'Assert'], Type.String(), 12345) ``` -When specifying user defined sequences, the return type of Parse will be unknown.