Class String

Sass's string type.

⚠️ Heads up!

This API currently provides no way of distinguishing between a quoted and unquoted string.

Hierarchy

  • String

Index

Constructors

Methods

Constructors

constructor

  • new String(value: string): String

Methods

getValue

  • getValue(): string
  • Returns the contents of the string. If the string contains escapes, those escapes are included literally if it’s unquoted, while the values of the escapes are included if it’s quoted.

    example
    // string is `Arial`.
    string.getValue(); // "Arial"

    // string is `"Helvetica Neue"`.
    string.getValue(); // "Helvetica Neue"

    // string is `\1F46D`.
    string.getValue(); // "\\1F46D"

    // string is `"\1F46D"`.
    string.getValue(); // "👭"

    Returns string

setValue

  • setValue(value: string): void
  • Destructively modifies this string by setting its numeric value to value.

    ⚠️ Heads up!

    Even if the string was originally quoted, this will cause it to become unquoted.

    deprecated

    Use constructor instead.

    Parameters

    • value: string

    Returns void