MCPcopy Create free account
hub / github.com/cortexkit/magic-context / parseTtlString

Function parseTtlString

packages/plugin/src/plugin/rpc-handlers.ts:98–113  ·  view source on GitHub ↗
(ttl: string)

Source from the content-addressed store, hash-verified

96}
97
98function parseTtlString(ttl: string): number {
99 const match = ttl.match(/^(\d+)(s|m|h)$/);
100 if (!match) return 5 * 60 * 1000;
101 const val = Number.parseInt(match[1], 10);
102 const unit = match[2];
103 switch (unit) {
104 case "s":
105 return val * 1000;
106 case "m":
107 return val * 60 * 1000;
108 case "h":
109 return val * 3600 * 1000;
110 default:
111 return 5 * 60 * 1000;
112 }
113}
114
115function resolveConfigValue<T>(
116 cfg: Record<string, unknown> | undefined,

Callers 1

buildStatusDetailFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected