• Create a new scalar token with value

    Values that represent an actual string but may be parsed as a different type should use a type other than 'PLAIN', as this function does not support any schema operations and won't check for such conflicts.

    Parameters

    • value: string

      The string representation of the value, which will have its content properly indented.

    • context: {
          end?: SourceToken[];
          implicitKey?: boolean;
          inFlow?: boolean;
          indent: number;
          offset?: number;
          type?: Type;
      }
      • Optional end?: SourceToken[]

        Comments and whitespace after the end of the value, or after the block scalar header. If undefined, a newline will be added.

      • Optional implicitKey?: boolean

        Being within an implicit key may affect the resolved type of the token's value.

      • Optional inFlow?: boolean

        Is this scalar within a flow collection? This may affect the resolved type of the token's value.

      • indent: number

        The indent level of the token.

      • Optional offset?: number

        The offset position of the token.

      • Optional type?: Type

        The preferred type of the scalar token. If undefined, the previous type of the token will be used, defaulting to 'PLAIN'.

    Returns BlockScalar | FlowScalar

Generated using TypeDoc