MCPcopy Create free account
hub / github.com/TanStack/ai / createConsoleMethod

Function createConsoleMethod

packages/ai-isolate-quickjs/src/isolate-driver.ts:100–109  ·  view source on GitHub ↗
(prefix: string)

Source from the content-addressed store, hash-verified

98
99 // Helper to create console methods
100 const createConsoleMethod = (prefix: string) => {
101 return vm.newFunction(`console.${prefix}`, (...args) => {
102 const parts = args.map((arg) => {
103 const str = vm.getString(arg)
104 return str
105 })
106 const msg = prefix ? `${prefix}: ${parts.join(' ')}` : parts.join(' ')
107 logs.push(msg)
108 })
109 }
110
111 const logFn = createConsoleMethod('')
112 const errorFn = createConsoleMethod('ERROR')

Callers 1

createContextFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected