Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

686 B
Raw Blame
// Controls, format characters (bidi overrides, zero-width, tags) and line separators can reorder or
// hide text, so host labels and renderer pickers strip them with this one predicate.
const UNSAFE_DISPLAY_CHARACTER = /[\p{Cc}\p{Cf}\p{Cs}\p{Zl}\p{Zp}]/u
// ZWNJ and ZWJ are format characters that Persian, Indic scripts and emoji sequences need.
const SAFE_JOINERS = new Set(['\u200c', '\u200d'])

export function isSafeDisplayCharacter(character: string): boolean {
  return SAFE_JOINERS.has(character) || !UNSAFE_DISPLAY_CHARACTER.test(character)
}

export function stripUnsafeDisplayCharacters(value: string): string {
  return [...value].filter(isSafeDisplayCharacter).join('')
}