webauthn::JQ (private)

 webauthn::JQ s

Defined in packages/webauthn/tcl/webauthn-procs.tcl

Perform quoting for JavaScript literals.

Parameters:
s (required)
Returns:
JSON-escaped string content (WITHOUT surrounding quotes).

Partial Call Graph (max 5 caller/called nodes):

Testcases:
No testcase defined.
Source code:
        set s [string map [list  "\\" "\\\\"  "\"" "\\\""  "\b" "\\b"  "\f" "\\f"  "\n" "\\n"  "\r" "\\r"  "\t" "\\t"  ] $s]

        if {[regexp {[[:cntrl:]]} $s]} {
            # Escape remaining control chars 0x00..0x1F
            set out ""
            set len [string length $s]
            for {set i 0} {$i < $len} {incr i} {
                set ch [string index $s $i]
                scan $ch %c code
                if {$code < 0x20} {
                    append out [format "\\u%04X" $code]
                } else {
                    append out $ch
                }
            }
            set s $out
        }
        return $s
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: