MCPcopy
hub / github.com/anomalyco/opencode / fill

Function fill

packages/app/src/utils/server-errors.test.ts:6–13  ·  view source on GitHub ↗
(text: string, vars?: Record<string, string | number>)

Source from the content-addressed store, hash-verified

4import { formatServerError, isSessionNotFoundError, parseReadableConfigInvalidError } from "./server-errors"
5
6function fill(text: string, vars?: Record<string, string | number>) {
7 if (!vars) return text
8 return text.replace(/{{\s*(\w+)\s*}}/g, (_, key: string) => {
9 const value = vars[key]
10 if (value === undefined) return ""
11 return String(value)
12 })
13}
14
15function useLanguageMock() {
16 const dict: Record<string, string> = {

Callers 1

tFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected