Type alias Placeholder

Placeholder: {
    apply: ((str, context?) => Promise<{
        result: string;
        [key: string]: unknown;
    }>);
    categories: PlaceholderCategory[];
    constant: boolean;
    dependencies?: string[];
    description: string;
    example: string;
    fn: ((...args) => Promise<string>);
    fullRepresentation: string;
    hintRepresentation: string;
    name: string;
    regex: RegExp;
    result_keys?: string[];
    rules?: ((str, context?) => Promise<boolean>)[];
    type: PlaceholderType;
}

Type declaration

  • apply: ((str, context?) => Promise<{
        result: string;
        [key: string]: unknown;
    }>)
      • (str, context?): Promise<{
            result: string;
            [key: string]: unknown;
        }>
      • The function that applies the placeholder to a string.

        Parameters

        • str: string

          The string to apply the placeholder to.

        • Optional context: {
              [key: string]: unknown;
          }
          • [key: string]: unknown

        Returns Promise<{
            result: string;
            [key: string]: unknown;
        }>

        The string with the placeholder applied.

  • categories: PlaceholderCategory[]

    The category of the placeholder, used to inform design decisions.

  • constant: boolean

    Whether or not the placeholder has a constant value during the placeholder substitution process. For example, users can use multiple URL placeholders, therefore it is not constant, while {{clipboardText}} is constant for the duration of the substitution process.

  • Optional dependencies?: string[]

    The dependencies of the placeholder. When placeholders are applied in bulk, this list is used to determine the order in which placeholders are applied.

  • description: string

    The description of the placeholder, shown when the placeholder is detected in a prompt.

  • example: string

    The example usage of the placeholder, shown when the placeholder is detected in a prompt.

  • fn: ((...args) => Promise<string>)
      • (...args): Promise<string>
      • The function that applies the placeholder to a string. This function is used when the placeholder is used a {{js:...}} placeholder.

        Parameters

        • Rest ...args: (never | string)[]

        Returns Promise<string>

  • fullRepresentation: string

    The full name representation of the placeholder, properly spaced.

  • hintRepresentation: string

    The demonstration representation of the placeholder, shown as the "name" of the placeholder when the placeholder is detected in a prompt.

  • name: string

    The detailed name of the placeholder.

  • regex: RegExp

    The regex pattern that matches the placeholder, including any aliases.

  • Optional result_keys?: string[]

    The keys of the result object relevant to the placeholder. When placeholders are applied in bulk, this list is used to determine which keys to return as well as to make optimizations when determining which placeholders to apply. The first key in the list is the key for the placeholder's value.

  • Optional rules?: ((str, context?) => Promise<boolean>)[]

    Rules that determine whether or not a placeholder is relevant in a given context.

  • type: PlaceholderType

    The type of the placeholder, used to inform design decisions.

Generated using TypeDoc