dessert
Index
Classes
Interfaces
Argument()
Argument():
undefined
|Primitive
Return the next argument, if there is a next argument
Returns
undefined
| Primitive
Defined in
src/dessert/deserialization/types.d.ts:61
Argument<
T
>(...types
):undefined
|TypeOf
<T
>
Return the next argument, if there is a next argument, requiring the argument to be of the given type
Type Parameters
Type Parameter |
---|
T extends [PrimitiveType , ...PrimitiveType[] ] |
Parameters
Parameter | Type |
---|---|
...types | T |
Returns
undefined
| TypeOf
<T
>
Throws
If the next argument does not match any of the given types
Defined in
src/dessert/deserialization/types.d.ts:67
Methods
if()
if<
T
>(...types
):undefined
|TypeOf
<T
>
Return the next argument, if there is a next argument and it has a valid type
Type Parameters
Type Parameter |
---|
T extends [PrimitiveType , ...PrimitiveType[] ] |
Parameters
Parameter | Type |
---|---|
...types | T |
Returns
undefined
| TypeOf
<T
>
Defined in
src/dessert/deserialization/types.d.ts:74
required()
Call Signature
required():
Primitive
Return the next argument
Returns
Throws
If there is no next argument
Defined in
src/dessert/deserialization/types.d.ts:83
Call Signature
required<
T
>(...types
):TypeOf
<T
>
Return the next argument
Type Parameters
Type Parameter |
---|
T extends [PrimitiveType , ...PrimitiveType[] ] |
Parameters
Parameter | Type |
---|---|
...types | T |
Returns
TypeOf
<T
>
Throws
If there is no next argument
Throws
If the next argument does not match any of the given types
Defined in
src/dessert/deserialization/types.d.ts:90
rest()
Call Signature
rest():
Primitive
[]
Return all remaining arguments
Returns
Defined in
src/dessert/deserialization/types.d.ts:97
Call Signature
rest<
T
>(...types
):TypeOf
<T
>[]
Return all remaining arguments
Type Parameters
Type Parameter |
---|
T extends [PrimitiveType , ...PrimitiveType[] ] |
Parameters
Parameter | Type |
---|---|
...types | T |
Returns
TypeOf
<T
>[]
Defined in
src/dessert/deserialization/types.d.ts:102
Child()
Child<
T
,P
>(name
,deserializer
, ...parameters
):undefined
|T
Returns the next child with the given name, if there is any
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
name | string |
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
undefined
| T
Throws
If the deserializer fails
Defined in
src/dessert/deserialization/types.d.ts:157
Properties
required()
required: <
T
,P
>(name
,deserializer
, ...parameters
) =>T
Returns the next child with the given name
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
name | string |
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
T
Throws
If there is no next child with the given name
Throws
If the deserializer fails
single()
Returns the next child with the given name and validate that there are no others
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
name | string |
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
T
Throws
If there is no next child with the given name
Throws
If the deserializer fails
Throws
If there are other children left with the given name
Defined in
src/dessert/deserialization/types.d.ts:163
single()
single: <
T
,P
>(name
,deserializer
, ...parameters
) =>undefined
|T
Returns the next child with the given name if there is any and validate that there are no others
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
name | string |
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
undefined
| T
Throws
If the deserializer fails
Throws
If there are other children left with the given name
required()
Returns the next child with the given name and validate that there are no others
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
name | string |
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
T
Throws
If there is no next child with the given name
Throws
If the deserializer fails
Throws
If there are other children left with the given name
Defined in
src/dessert/deserialization/types.d.ts:189
Children()
Children<
T
,P
>(name
,deserializer
, ...parameters
):T
[]
Returns all remaining children with the given name
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
name | string |
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
T
[]
Throws
If the deserializer fails
Defined in
src/dessert/deserialization/types.d.ts:222
Properties
entries()
entries: <
T
,P
>(deserializer
, ...parameters
) => [string
,T
][]
Returns all remaining children with their name
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
[string
, T
][]
Throws
If the deserializer fails
filtered()
filtered: <
T
,P
>(filter
,deserializer
, ...parameters
) => [string
,T
][]
Returns all remaining children with their name if that name matches the given filter
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
filter | RegExp |
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
[string
, T
][]
Throws
If the deserializer fails
filtered.unique()
Returns all remaining children with their name if that name matches the given filter, requiring all matching names to be unique
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
filter | RegExp |
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
[string
, T
][]
Throws
If the deserializer fails
Throws
If a duplicate name is encountered
unique()
unique: <
T
,P
>(deserializer
, ...parameters
) => [string
,T
][]
Returns all remaining children with their name, requiring all names to be unique
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
[string
, T
][]
Throws
If the deserializer fails
Throws
If a duplicate name is encountered
unique.filtered()
Returns all remaining children with their name if that name matches the given filter, requiring all matching names to be unique
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
filter | RegExp |
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
[string
, T
][]
Throws
If the deserializer fails
Throws
If a duplicate name is encountered
Defined in
src/dessert/deserialization/types.d.ts:240
Methods
required()
required<
T
,P
>(name
,deserializer
, ...parameters
): [T
,...T[]
]
Returns all remaining children with the given name, requiring at least one such child
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
name | string |
deserializer | Deserializer <T , P > |
...parameters | P |
Returns
[T
, ...T[]
]
Throws
If the deserializer fails
Throws
If there are no remaining children with the given name
Defined in
src/dessert/deserialization/types.d.ts:234
DeserializationContext
Wrapper around a Node to help deserializing a single Node into a value
Properties
argument
readonly
argument:Argument
Helper to access the node's arguments
Defined in
src/dessert/deserialization/types.d.ts:385
child
readonly
child:Child
Helper to access the node's children
Defined in
src/dessert/deserialization/types.d.ts:394
children
readonly
children:Children
Helper to access the node's children
Defined in
src/dessert/deserialization/types.d.ts:398
json
readonly
json:Json
Helper for processing the node as JSON
Defined in
src/dessert/deserialization/types.d.ts:403
name
readonly
name:string
Name of the node being deserialized
Defined in
src/dessert/deserialization/types.d.ts:375
property
readonly
property:Property
Helper to access the node's properties
Defined in
src/dessert/deserialization/types.d.ts:389
run()
readonly
run: <T
,P
>(deserializer
, ...parameters
) =>T
Run the given deserializer
Type Parameters
Type Parameter |
---|
T |
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
deserializer | DeserializerFromContext <T , P > |
...parameters | P |
Returns
T
Defined in
src/dessert/deserialization/types.d.ts:408
tag
readonly
tag:null
|string
Tag of the node being deserialized
Defined in
src/dessert/deserialization/types.d.ts:380
DocumentSerializationContext
Wrapper around a Document to help serializing a value or values into a Document
Properties
child()
readonly
child: <P
>(name
,serializer
, ...params
) =>void
Run the given serializer to create a node with the given name and add that node as child to the document being serialized
Type Parameters
Type Parameter |
---|
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
name | string |
serializer | Serializer <P > |
...params | P |
Returns
void
tagged()
Run the given serializer to create a node with the given name and tag and add that node as child to the document being serialized
Type Parameters
Type Parameter |
---|
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
tag | string |
name | string |
serializer | Serializer <P > |
...params | P |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:149
json()
readonly
json: (value
) =>void
Serialize a JSON value
The allowed values are limited to only values that can be entirely serialized into nodes placed inside the document. For example, a string value would be added as argument but a document can't have arguments.
Parameters
Parameter | Type |
---|---|
value | JsonObject | JsonValue [] |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:175
run()
readonly
run: <P
>(serializer
, ...parameters
) =>void
Run the given serializer
Type Parameters
Type Parameter |
---|
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
serializer | DocumentSerializer <P > |
...parameters | P |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:180
source()
readonly
source: (sourceCtx
) =>void
Link this serialization to a prior deserialization
Attaching a deserialization context as source to this serialization allows the serialization to keep track of metadata in the original text. For example, an effort is made to preserve formatting and comments.
Parameters
Parameter | Type |
---|---|
sourceCtx | undefined | null | DeserializationContext |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:145
target
readonly
target:"document"
Marker property that can be used to distinguish between a DocumentSerializationContext and SerializationContext.
Defined in
src/dessert/serialization/types.d.ts:137
Json()
Json():
undefined
|JsonValue
Turn the remaining arguments, properties, and children into a JSON value
After calling this function, all remaining arguments, properties, and children of the context have been consumed. Further calls to any of the context's utilities will return undefined or throw, depending on how the utility handles an empty context.
Returns
undefined
| JsonValue
Throws
If the context doesn't contain a valid JSON value
Defined in
src/dessert/deserialization/types.d.ts:333
Json<
T
>(...types
):undefined
|JsonTypeOf
<T
>
Turn the remaining arguments, properties, and children into a JSON value matching any of the given types
After calling this function, all remaining arguments, properties, and children of the context have been consumed. Further calls to any of the context's utilities will return undefined or throw, depending on how the utility handles an empty context.
Type Parameters
Type Parameter |
---|
T extends [JsonType , ...JsonType[] ] |
Parameters
Parameter | Type |
---|---|
...types | T |
Returns
undefined
| JsonTypeOf
<T
>
Throws
If the context doesn't contain a valid JSON value
Throws
If the deserialized value doesn't match any of the given types
Defined in
src/dessert/deserialization/types.d.ts:343
Methods
required()
Call Signature
required():
JsonValue
Turn the remaining arguments, properties, and children into a JSON value
After calling this function, all remaining arguments, properties, and children of the context have been consumed. Further calls to any of the context's utilities will return undefined or throw, depending on how the utility handles an empty context.
Returns
Throws
If the context doesn't contain a valid JSON value
Throws
If the context is empty
Defined in
src/dessert/deserialization/types.d.ts:354
Call Signature
required<
T
>(...types
):JsonTypeOf
<T
>
Turn the remaining arguments, properties, and children into a JSON value matching any of the given types
After calling this function, all remaining arguments, properties, and children of the context have been consumed. Further calls to any of the context's utilities will return undefined or throw, depending on how the utility handles an empty context.
Type Parameters
Type Parameter |
---|
T extends [JsonType , ...JsonType[] ] |
Parameters
Parameter | Type |
---|---|
...types | T |
Returns
JsonTypeOf
<T
>
Throws
If the context doesn't contain a valid JSON value
Throws
If the context is empty
Throws
If the deserialized value doesn't match any of the given types
Defined in
src/dessert/deserialization/types.d.ts:365
Property()
Property(
name
):undefined
|Primitive
Return the property with the given name if it exists and it hasn't been returned yet
Parameters
Parameter | Type |
---|---|
name | string |
Returns
undefined
| Primitive
Defined in
src/dessert/deserialization/types.d.ts:109
Property<
T
>(name
, ...types
):undefined
|TypeOf
<T
>
Return the property with the given name if it exists and it hasn't been returned yet
Type Parameters
Type Parameter |
---|
T extends [PrimitiveType , ...PrimitiveType[] ] |
Parameters
Parameter | Type |
---|---|
name | string |
...types | T |
Returns
undefined
| TypeOf
<T
>
Throws
If the property value does not match any of the given types
Defined in
src/dessert/deserialization/types.d.ts:115
Methods
if()
if<
T
>(name
, ...types
):undefined
|TypeOf
<T
>
Return the property with the given name if it exists and it hasn't been returned yet and its value has the correct type
Type Parameters
Type Parameter |
---|
T extends [PrimitiveType , ...PrimitiveType[] ] |
Parameters
Parameter | Type |
---|---|
name | string |
...types | T |
Returns
undefined
| TypeOf
<T
>
Defined in
src/dessert/deserialization/types.d.ts:123
required()
Call Signature
required(
name
):Primitive
Return the property with the given name
Parameters
Parameter | Type |
---|---|
name | string |
Returns
Throws
If the property doesn't exist or it has already been returned
Defined in
src/dessert/deserialization/types.d.ts:133
Call Signature
required<
T
>(name
, ...types
):TypeOf
<T
>
Return the property with the given name
Type Parameters
Type Parameter |
---|
T extends [PrimitiveType , ...PrimitiveType[] ] |
Parameters
Parameter | Type |
---|---|
name | string |
...types | T |
Returns
TypeOf
<T
>
Throws
If the property doesn't exist or it has already been returned
Throws
If the property value does not match any of the given types
Defined in
src/dessert/deserialization/types.d.ts:140
rest()
rest():
Map
<string
,Primitive
>
Return all remaining properties
Returns
Map
<string
, Primitive
>
Defined in
src/dessert/deserialization/types.d.ts:148
SerializationContext
Wrapper around a Node to help serializing a value into a single Node
Properties
argument()
readonly
argument: (value
) =>void
Add an argument to the serialized node
Parameters
Parameter | Type |
---|---|
value | Primitive |
Returns
void
tagged()
Add an argument with a tag to the serialized node
Parameters
Parameter | Type |
---|---|
tag | string |
value | Primitive |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:67
child()
readonly
child: <P
>(name
,serializer
, ...params
) =>void
Serialize a child node and add it to this serialized node
Run the given serializer to create a node with the given name and add that node as child to the node being serialized
Type Parameters
Type Parameter |
---|
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
name | string |
serializer | Serializer <P > |
...params | P |
Returns
void
tagged()
Run the given serializer to create a node with the given name and tag and add that node as child to the node being serialized
Type Parameters
Type Parameter |
---|
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
tag | string |
name | string |
serializer | Serializer <P > |
...params | P |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:96
json()
readonly
json: (value
) =>void
Serialize a JSON value
Parameters
Parameter | Type |
---|---|
value | JsonValue |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:119
property()
readonly
property: (name
,value
) =>void
Set a property on the serialized node
If the same property was already set previously, the previous value is overwritten.
Parameters
Parameter | Type |
---|---|
name | string |
value | Primitive |
Returns
void
tagged()
Set a property with a tag on the serialized node
If the same property was already set previously, the previous value is overwritten.
Parameters
Parameter | Type |
---|---|
tag | string |
name | string |
value | Primitive |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:78
run()
readonly
run: <P
>(serializer
, ...parameters
) =>void
Run the given serializer
Type Parameters
Type Parameter |
---|
P extends unknown [] |
Parameters
Parameter | Type |
---|---|
serializer | SerializerFromContext <P > |
...parameters | P |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:124
source()
readonly
source: (sourceCtx
) =>void
Link this serialization to a prior deserialization
Attaching a deserialization context as source to this serialization allows the serialization to keep track of metadata in the original text. For example, an effort is made to preserve formatting and comments.
Parameters
Parameter | Type |
---|---|
sourceCtx | undefined | null | DeserializationContext |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:63
target
readonly
target:"node"
Marker property that can be used to distinguish between a DocumentSerializationContext and SerializationContext.
Defined in
src/dessert/serialization/types.d.ts:55
Type Aliases
Deserialized<T>
Deserialized<
T
>:T
extendsDeserializer
<infer V,any
[]> ?V
:never
Helper type to extract the type a deserializer supports
Type Parameters
Type Parameter |
---|
T extends Deserializer <unknown , any []> |
Defined in
src/dessert/deserialization/types.d.ts:54
Deserializer<T, P>
Deserializer<
T
,P
>:DeserializerFromContext
<T
,P
> | {deserializeFromNode
:T
; }
Function or object capable of deserializing objects of type T
There are three types of deserializers:
- Functions that are given a DeserializationContext
- A value (usually a class) with a
deserialize
function that is given a DeserializationContext - A value (usually a class) with a
deserializeFromNode
function that is given a Node
All three variants can be parameterized.
Parameters can be passed via deserialize
or any of the child
/children
functions on a DeserializationContext
Type Parameters
Type Parameter | Default type |
---|---|
T | - |
P extends unknown [] | [] |
Type declaration
DeserializerFromContext
<T
, P
>
{ deserializeFromNode
: T
; }
deserializeFromNode()
Function that is given a Node
Parameters
Parameter | Type |
---|---|
node | Node |
...parameters | P |
Returns
T
Defined in
src/dessert/deserialization/types.d.ts:44
DeserializerFromContext<T, P>
DeserializerFromContext<
T
,P
>: (ctx
, ...parameters
) =>T
| {deserialize
:T
; }
Function or object capable of deserializing objects of type T
using a DeserializationContext
Type Parameters
Type Parameter | Default type |
---|---|
T | - |
P extends unknown [] | [] |
Type declaration
(ctx
, ...parameters
) => T
Parameters
Parameter | Type |
---|---|
ctx | DeserializationContext |
...parameters | P |
Returns
T
{ deserialize
: T
; }
deserialize()
Function that is given a DeserializationContext
Parameters
Parameter | Type |
---|---|
ctx | DeserializationContext |
...parameters | P |
Returns
T
Defined in
src/dessert/deserialization/types.d.ts:26
DocumentSerializer<P>
DocumentSerializer<
P
>: (ctx
, ...parameters
) =>void
| {serialize
:void
; }
Function or object capable of serializing a Document
There are three types of serializers:
- Functions that are given a SerializationContext
- A value (usually a class instance) with a
serialize
function that is given a SerializationContext
Both types can accept parameters, in which case these parameters have to be passed when calling serialize.
Type Parameters
Type Parameter |
---|
P extends unknown [] |
Type declaration
(ctx
, ...parameters
) => void
Parameters
Parameter | Type |
---|---|
ctx | DocumentSerializationContext |
...parameters | P |
Returns
void
{ serialize
: void
; }
serialize()
Function that is given a DocumentSerializationContext
Parameters
Parameter | Type |
---|---|
ctx | DocumentSerializationContext |
...parameters | P |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:41
JsonType
JsonType:
PrimitiveType
|"object"
|"array"
String representation of the JsonValue types
Defined in
src/dessert/deserialization/types.d.ts:304
JsonTypeOf<T>
JsonTypeOf<
T
>:object
[T
[number
]]
Helper type to turn JsonTypes into the corresponding JsonValue types
Type Parameters
Type Parameter |
---|
T extends JsonType [] |
Defined in
src/dessert/deserialization/types.d.ts:309
PrimitiveType
PrimitiveType:
"boolean"
|"null"
|"number"
|"string"
String representation of the Primitive types
Defined in
src/dessert/deserialization/types.d.ts:7
Serializer<P>
Serializer<
P
>:SerializerFromContext
<P
> | {serializeToNode
:Node
; }
Function or object capable of serializing a Node
There are three types of serializers:
- Functions that are given a SerializationContext
- A value (usually a class instance) with a
serialize
function that is given a SerializationContext - A value (usually a class instance) with a
serializeTNode
function that returns a Node
All three of these types can accept parameters, in which case these parameters have to be passed when calling serialize.
Type Parameters
Type Parameter |
---|
P extends unknown [] |
Type declaration
{ serializeToNode
: Node
; }
serializeToNode()
Function to serialize a Node of the given name
Parameters
Parameter | Type |
---|---|
name | string |
...parameters | P |
Returns
Defined in
src/dessert/serialization/types.d.ts:25
SerializerFromContext<P>
SerializerFromContext<
P
>: (ctx
, ...parameters
) =>void
| {serialize
:void
; }
Function or object capable of serializing via a SerializationContext
Type Parameters
Type Parameter |
---|
P extends unknown [] |
Type declaration
(ctx
, ...parameters
) => void
Parameters
Parameter | Type |
---|---|
ctx | SerializationContext |
...parameters | P |
Returns
void
{ serialize
: void
; }
serialize()
Function that is given a SerializationContext
Parameters
Parameter | Type |
---|---|
ctx | SerializationContext |
...parameters | P |
Returns
void
Defined in
src/dessert/serialization/types.d.ts:8
TypeOf<T>
TypeOf<
T
>:object
[T
[number
]]
Helper type to turn a list of PrimitiveTypes into matching Primitive types
Type Parameters
Type Parameter |
---|
T extends PrimitiveType [] |
Defined in
src/dessert/deserialization/types.d.ts:12
Functions
concat()
concat(...
docsAndNodes
):Document
Create a document containing the given nodes in order
If documents are passed, all nodes from those documents will be inserted in order into the returned document.
Parameters
Returns
Defined in
src/dessert/serialization/public-utils.js:12
deserialize()
deserialize<
T
,P
>(node
,deserializer
, ...parameters
):T
Deserialize the given Document or Node using the given deserializer.
If this function is given a Document, it will be wrapped with a nameless node (using "-" as name) without any arguments or properties.
Type Parameters
Type Parameter | Default type | Description |
---|---|---|
T | - | |
P extends unknown [] | [] |
Parameters
Parameter | Type | Description |
---|---|---|
node | Node | Document | |
deserializer | Deserializer <T , P > | |
...parameters | P |
Returns
T
Defined in
src/dessert/deserialization/deserialize.js:521
firstMatchingDeserializer()
firstMatchingDeserializer<
T
>(...deserializers
):Deserializer
<Deserialized
<T
[number
]>>
Create a deserializer that tries all of the given deserializers until it finds one that doesn't throw an error.
The returned deserializer throws an AggregateError
if all of the given deserializers throw on a certain node.
Type Parameters
Type Parameter | Description |
---|---|
T extends Deserializer <unknown >[] |
Parameters
Parameter | Type | Description |
---|---|---|
...deserializers | T |
Returns
Deserializer
<Deserialized
<T
[number
]>>
Defined in
src/dessert/deserialization/public-utils.js:59
format()
format<
P
>(serializer
, ...parameters
):string
Serialize a KDL document and format it to a string
Type Parameters
Type Parameter | Description |
---|---|
P extends unknown [] |
Parameters
Parameter | Type | Description |
---|---|---|
serializer | DocumentSerializer <P > | |
...parameters | P |
Returns
string
Defined in
src/dessert/serialization/serialize.js:181
parse()
parse<
T
>(text
,deserializer
):T
Parse the given KDL text as a document and run it through the given deserializer
The deserializer will only have access to children, as a document has no arguments or properties.
This is a small function that runs parse and then runs the resulting Document through deserialize.
Type Parameters
Type Parameter | Description |
---|---|
T |
Parameters
Parameter | Type | Description |
---|---|---|
text | string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | |
deserializer | Deserializer <T , []> |
Returns
T
Defined in
src/dessert/deserialization/deserialize.js:650
repeat()
repeat<
A
,T
>(fn
, ...args
):undefined
| [T
,...T[]
]
Call the given function with the given arguments until it returns undefined
This function returns all return values apart from the final undefined. If the given function returned undefined on the first call, this function returns undefined.
Type Parameters
Type Parameter | Description |
---|---|
A extends unknown [] | |
T |
Parameters
Parameter | Type | Description |
---|---|---|
fn | (...args ) => undefined | T | |
...args | A |
Returns
undefined
| [T
, ...T[]
]
Defined in
src/dessert/deserialization/public-utils.js:20
serialize()
Call Signature
serialize<
P
>(name
,serializer
, ...params
):Node
Create a node with the given name using the given serializer
Type Parameters
Type Parameter |
---|
P extends unknown [] |
Parameters
Parameter | Type | Description |
---|---|---|
name | string | The name of the node |
serializer | Serializer <P > | Serializer to call |
...params | P | Parameters to pass along to the serializer |
Returns
Defined in
src/dessert/serialization/types.d.ts:193
Call Signature
serialize<
P
>(name
,serializer
, ...params
):Document
Create a document using the given serializer
The first parameter can be null or typeof Document.
Passing null
is easiest, but it won't work when using TypeScript with "strictNullChecks" disabled.
Type Parameters
Type Parameter |
---|
P extends unknown [] |
Parameters
Parameter | Type | Description |
---|---|---|
name | null | typeof Document | Null or a refernece to the Document class |
serializer | DocumentSerializer <P > | Serializer to call |
...params | P | Parameters to pass along to the serializer |