MCPcopy Create free account
hub / github.com/chainjet/platform / stringifyInput

Function stringifyInput

apps/runner/src/utils/input.utils.ts:173–184  ·  view source on GitHub ↗
(input: unknown)

Source from the content-addressed store, hash-verified

171}
172
173export function stringifyInput(input: unknown): string {
174 if (_.isPlainObject(input)) {
175 return JSON.stringify(input).replace(/"/g, '\\"')
176 }
177 if (_.isDate(input)) {
178 return input.toISOString()
179 }
180 if (Array.isArray(input)) {
181 return `[${input.map((x) => stringifyInput(x)).join(',')}]`
182 }
183 return (input as string) ?? ''
184}
185
186export function findOutputKeys(input: Record<string, any>, key: string): string[] {
187 const regex = new RegExp(`{{\\s*${key}\\.(\\w+)\\s*}}`, 'g')

Callers 2

parseInputFunction · 0.85
calculateExpressionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected