Class Tokenization
Less oft-needed functions to manipulate Tokens.
public class Tokenization : DeputyBase
- Inheritance
-
Tokenization
Methods
IsResolvable(object)
Return whether the given object is an IResolvable object.
public static bool IsResolvable(object obj)
Parameters
obj
object
Returns
Remarks
This is different from Token.isUnresolved() which will also check for encoded Tokens, whereas this method will only do a type check on the given object.
Resolve(object, IResolveOptions)
Resolves an object by evaluating all tokens and removing any undefined or empty objects or arrays.
public static object Resolve(object obj, IResolveOptions options)
Parameters
obj
objectThe object to resolve.
options
IResolveOptionsPrefix key path components for diagnostics.
Returns
Remarks
Values can only be primitives, arrays or tokens. Other objects (i.e. with methods) will be rejected.
Reverse(object, IReverseOptions?)
Reverse any value into a Resolvable, if possible.
public static IResolvable? Reverse(object x, IReverseOptions? options = null)
Parameters
x
objectoptions
IReverseOptions
Returns
Remarks
In case of a string, the string must not be a concatenation.
ReverseCompleteString(string)
Un-encode a string which is either a complete encoded token, or doesn't contain tokens at all.
public static IResolvable? ReverseCompleteString(string s)
Parameters
s
string
Returns
Remarks
It's illegal for the string to be a concatenation of an encoded token and something else.
ReverseList(string[])
Un-encode a Tokenized value from a list.
public static IResolvable? ReverseList(string[] l)
Parameters
l
string[]
Returns
ReverseNumber(double)
Un-encode a Tokenized value from a number.
public static IResolvable? ReverseNumber(double n)
Parameters
n
double
Returns
ReverseString(string)
Un-encode a string potentially containing encoded tokens.
public static TokenizedStringFragments ReverseString(string s)
Parameters
s
string
Returns
StringifyNumber(double)
Stringify a number directly or lazily if it's a Token.
public static string StringifyNumber(double x)
Parameters
x
double
Returns
Remarks
If it is an object (i.e., { Ref: 'SomeLogicalId' }), return it as-is.