The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import * as DateTime from "effect/DateTime"; |
| 2 | import * as Option from "effect/Option"; |
| 3 | |
| 4 | export function trimOptionalString(value: string | null | undefined): string | null { |
| 5 | const trimmed = value?.trim() ?? ""; |
| 6 | return trimmed.length > 0 ? trimmed : null; |
| 7 | } |
| 8 | |
| 9 | export function isCommitSha(value: string): boolean { |
| 10 | return /^[0-9a-f]{7,64}$/i.test(value); |
| 11 | } |
| 12 | |
| 13 | /** Normalize host timestamps to UTC for cross-host string sorting. */ |
| 14 | export function toIsoUtc(value: string): string { |
| 15 | return Option.match(DateTime.make(value), { onNone: () => value, onSome: DateTime.formatIso }); |
| 16 | } |
| 17 | |
| 18 | export function normalizeRefName(refName: string): string { |
| 19 | return refName.trim().replace(/^refs\/heads\//, ""); |
| 20 | } |
| 21 | |
| 22 | export function normalizeHost(host: string): string { |
| 23 | return host.trim().toLowerCase(); |
| 24 | } |