# Tokenization

Less oft-needed functions to manipulate Tokens.

- Source: [`core/lib/token.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/core/lib/token.ts#L142)

## Methods

- `isResolvable(obj: any): boolean` (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` (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.

  **Parameters**

  - `obj` — The object to resolve.
  - `options` — Prefix key path components for diagnostics.

- `reverse(x: any, 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` (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` (static) — Un-encode a Tokenized value from a list.

- `reverseNumber(n: number): IResolvable` (static) — Un-encode a Tokenized value from a number.

- `reverseString(s: string): TokenizedStringFragments` (static) — Un-encode a string potentially containing encoded tokens.

- `stringifyNumber(x: number): 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.
