Function esQuoteKey

  • Conditionally quotes JavaScript key.

    If the given key is valid JavaScript identifier, then leaves it as is. Otherwise, encloses it into quotes and properly escapes if necessary.

    Parameters

    • key: string

      A key to quote.

    • Optional quote: "'" | "\"" | "`"

      Quote symbol to use.

    Returns string

    Conditionally quoted string.

Generated using TypeDoc