Download packages/app/src/components/session/session-context-format.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 652 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/components/session/session-context-format.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/app/src/components/session/session-context-format.ts
-
curl -L -o session-context-format.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/components/session/session-context-format.ts
652 Bytes
| import { DateTime } from "luxon" | |
| export function createSessionContextFormatter(locale: string) { | |
| return { | |
| number(value: number | null | undefined) { | |
| if (value === undefined) return "β" | |
| if (value === null) return "β" | |
| return value.toLocaleString(locale) | |
| }, | |
| percent(value: number | null | undefined) { | |
| if (value === undefined) return "β" | |
| if (value === null) return "β" | |
| return value.toLocaleString(locale) + "%" | |
| }, | |
| time(value: number | undefined) { | |
| if (!value) return "β" | |
| return DateTime.fromMillis(value).setLocale(locale).toLocaleString(DateTime.DATETIME_MED) | |
| }, | |
| } | |
| } | |