MCPcopy Create free account
hub / github.com/Noumena-Network/code / parseTokenBudget

Function parseTokenBudget

src/utils/tokenBudget.ts:21–29  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

19}
20
21export function parseTokenBudget(text: string): number | null {
22 const startMatch = text.match(SHORTHAND_START_RE)
23 if (startMatch) return parseBudgetMatch(startMatch[1]!, startMatch[2]!)
24 const endMatch = text.match(SHORTHAND_END_RE)
25 if (endMatch) return parseBudgetMatch(endMatch[1]!, endMatch[2]!)
26 const verboseMatch = text.match(VERBOSE_RE)
27 if (verboseMatch) return parseBudgetMatch(verboseMatch[1]!, verboseMatch[2]!)
28 return null
29}
30
31export function findTokenBudgetPositions(
32 text: string,

Callers 2

createReplOnQueryFunction · 0.85

Calls 1

parseBudgetMatchFunction · 0.85

Tested by

no test coverage detected