MCPcopy Index your code
hub / github.com/callstack/agent-device / safeStateName

Function safeStateName

src/remote/remote-connection-state.ts:284–290  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

282}
283
284function safeStateName(value: string): string {
285 const safe = value.replaceAll(/[^a-zA-Z0-9._-]/g, '_');
286 if (!safe) return 'default';
287 if (safe === value) return safe;
288 const suffix = crypto.createHash('sha256').update(value).digest('hex').slice(0, 8);
289 return `${safe}-${suffix}`;
290}
291
292function isRemoteConnectionState(value: unknown): value is RemoteConnectionState {
293 if (!value || typeof value !== 'object' || Array.isArray(value)) return false;

Callers 1

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected