@maschinenlesbar.org/strahlenschutz-cli
    Preparing search index...

    Function quoteValue

    • Quote a value for an error message, as JSON.stringify does, and also escape what it leaves raw although a terminal acts on it: DEL, the C1 controls, every Unicode format character (bidi overrides, zero-width characters, a soft hyphen) and the line and paragraph separators U+2028/U+2029, which a viewer may break the line at. A refused value is echoed in messages, and an invisible character in it must be seen ("a\u200bb"), never hidden; an override would reorder the rest of the line ("Trojan Source"). A lone surrogate is escaped by JSON.stringify itself. A value longer than max characters (default MAX_QUOTED_LENGTH) is cut, never inside a surrogate pair, and the "…" goes after the closing quote ("AAAA"…), so it does not read as part of the value. The quoted part stays a valid JSON string.

      Parameters

      • value: string
      • max: number = MAX_QUOTED_LENGTH

      Returns string