Skip to content

createScalarToken

createScalarToken(value, context): FlowScalar | BlockScalar

Defined in: src/source/cst-scalar.ts:97

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.

string

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

SourceToken[]

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

boolean

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

number

The indent level of the token.

boolean

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

number

The offset position of the token.

ScalarType

The preferred type of the scalar token, defaulting to 'PLAIN'.

FlowScalar | BlockScalar