Skip to content

Tokenization

Less oft-needed functions to manipulate Tokens.

Static Functions

Name Description
isResolvable Return whether the given object is an IResolvable object.
resolve Resolves an object by evaluating all tokens and removing any undefined or empty objects or arrays.
reverseList Un-encode a Tokenized value from a list.
reverseNumber Un-encode a Tokenized value from a number.
reverseString Un-encode a string potentially containing encoded tokens.
stringifyNumber Stringify a number directly or lazily if it's a Token.

isResolvable

import { Tokenization } from '@alicloud/ros-cdk-core'
Tokenization.isResolvable(obj: any)

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.

objRequired

  • Type: any

resolve

import { Tokenization } from '@alicloud/ros-cdk-core'
Tokenization.resolve(obj: any, options: ResolveOptions)

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.

objRequired

  • Type: any

The object to resolve.


optionsRequired

Prefix key path components for diagnostics.


reverseList

import { Tokenization } from '@alicloud/ros-cdk-core'
Tokenization.reverseList(l: string[])

Un-encode a Tokenized value from a list.

lRequired

  • Type: string[]

reverseNumber

import { Tokenization } from '@alicloud/ros-cdk-core'
Tokenization.reverseNumber(n: number)

Un-encode a Tokenized value from a number.

nRequired

  • Type: number

reverseString

import { Tokenization } from '@alicloud/ros-cdk-core'
Tokenization.reverseString(s: string)

Un-encode a string potentially containing encoded tokens.

sRequired

  • Type: string

stringifyNumber

import { Tokenization } from '@alicloud/ros-cdk-core'
Tokenization.stringifyNumber(x: number)

Stringify a number directly or lazily if it's a Token.

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

xRequired

  • Type: number