UNPKG

1.05 kBTypeScriptView Raw
1import { IFragmentConcatenator, IResolvable } from './resolvable';
2/**
3 * Fragments of a concatenated string containing stringified Tokens
4 */
5export declare class TokenizedStringFragments {
6 private readonly fragments;
7 get firstToken(): IResolvable | undefined;
8 get firstValue(): any;
9 get length(): number;
10 addLiteral(lit: any): void;
11 addToken(token: IResolvable): void;
12 addIntrinsic(value: any): void;
13 /**
14 * Return all Tokens from this string
15 */
16 get tokens(): IResolvable[];
17 /**
18 * Apply a transformation function to all tokens in the string
19 */
20 mapTokens(mapper: ITokenMapper): TokenizedStringFragments;
21 /**
22 * Combine the string fragments using the given joiner.
23 *
24 * If there are any
25 */
26 join(concat: IFragmentConcatenator): any;
27}
28/**
29 * Interface to apply operation to tokens in a string
30 *
31 * Interface so it can be exported via jsii.
32 */
33export interface ITokenMapper {
34 /**
35 * Replace a single token
36 */
37 mapToken(t: IResolvable): any;
38}