Skip to content
v2.277.0

Tokenization Class ​

Less oft-needed functions to manipulate Tokens.

Methods ​

isResolvable(obj: any): boolean@staticmethod def is_resolvable(obj: Any) -> boolpublic static Boolean isResolvable(Object obj)public static bool IsResolvable(object obj)func IsResolvable(Obj interface{}) *bool static #
Return whether the given object is an IResolvable object.

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(obj: any, options: ResolveOptions): any@staticmethod def resolve(obj: Any, options: ResolveOptions) -> Anypublic static Object resolve(Object obj, ResolveOptions options)public static object Resolve(object obj, ResolveOptions options)func Resolve(Obj interface{}, Options ResolveOptions) interface{} static #
Resolves an object by evaluating all tokens and removing any undefined or empty objects or arrays.

Values can only be primitives, arrays or tokens. Other objects (i.e. with methods) will be rejected.

2 parameters

Parameters

  • objobjobjobjObj — The object to resolve.
  • optionsoptionsoptionsoptionsOptions — Prefix key path components for diagnostics.
reverse(x: any, options?: ReverseOptions): IResolvable@staticmethod def reverse(x: Any, options: typing.Optional[ReverseOptions] = None) -> IResolvablepublic static IResolvable reverse(Object x, ReverseOptions options)public static IResolvable Reverse(object x, ReverseOptions? options = null)func Reverse(X interface{}, Options ReverseOptions) IResolvable static #
Reverse any value into a Resolvable, if possible.

In case of a string, the string must not be a concatenation.

reverseCompleteString(s: string): IResolvable@staticmethod def reverse_complete_string(s: str) -> IResolvablepublic static IResolvable reverseCompleteString(String s)public static IResolvable ReverseCompleteString(string s)func ReverseCompleteString(S *string) IResolvable static #
Un-encode a string which is either a complete encoded token, or doesn't contain tokens at all.

It's illegal for the string to be a concatenation of an encoded token and something else.

reverseList(l: string[]): IResolvable@staticmethod def reverse_list(l: typing.List[str]) -> IResolvablepublic static IResolvable reverseList(List<String> l)public static IResolvable ReverseList(string[] l)func ReverseList(L *[]*string) IResolvable static #
Un-encode a Tokenized value from a list.
reverseNumber(n: number): IResolvable@staticmethod def reverse_number(n: int | float) -> IResolvablepublic static IResolvable reverseNumber(Number n)public static IResolvable ReverseNumber(double n)func ReverseNumber(N *float64) IResolvable static #
Un-encode a Tokenized value from a number.
reverseString(s: string): TokenizedStringFragments@staticmethod def reverse_string(s: str) -> TokenizedStringFragmentspublic static TokenizedStringFragments reverseString(String s)public static TokenizedStringFragments ReverseString(string s)func ReverseString(S *string) TokenizedStringFragments static #
Un-encode a string potentially containing encoded tokens.
stringifyNumber(x: number): string@staticmethod def stringify_number(x: int | float) -> strpublic static String stringifyNumber(Number x)public static string StringifyNumber(double x)func StringifyNumber(X *float64) *string static #
Stringify a number directly or lazily if it's a Token.

If it is an object (i.e., { Ref: 'SomeLogicalId' }), return it as-is.