MCPcopy Create free account
hub / github.com/Noumena-Network/code / identifySequence

Function identifySequence

src/ink/termio/parser.ts:291–302  ·  view source on GitHub ↗

* Identify the type of escape sequence from its raw form.

(
  seq: string,
)

Source from the content-addressed store, hash-verified

289 * Identify the type of escape sequence from its raw form.
290 */
291function identifySequence(
292 seq: string,
293): 'csi' | 'osc' | 'esc' | 'ss3' | 'unknown' {
294 if (seq.length < 2) return 'unknown'
295 if (seq.charCodeAt(0) !== C0.ESC) return 'unknown'
296
297 const second = seq.charCodeAt(1)
298 if (second === 0x5b) return 'csi' // [
299 if (second === 0x5d) return 'osc' // ]
300 if (second === 0x4f) return 'ss3' // O
301 return 'esc'
302}
303
304// =============================================================================
305// Main Parser

Callers 1

processSequenceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected