MCPcopy Index your code
hub / github.com/deepnote/deepnote / outputToon

Function outputToon

packages/cli/src/output.ts:165–185  ·  view source on GitHub ↗
(data: unknown, options?: { showEfficiencyHint?: boolean })

Source from the content-addressed store, hash-verified

163 * @see https://toonformat.dev/
164 */
165export function outputToon(data: unknown, options?: { showEfficiencyHint?: boolean }): void {
166 const toonOutput = toonEncode(data)
167 console.log(toonOutput)
168
169 // Show efficiency hint if enabled and not in quiet mode
170 if (options?.showEfficiencyHint && !currentConfig.quiet) {
171 // Pass pre-encoded toonOutput to avoid re-encoding
172 const { savingsPercent, toonRecommended } = analyzeToonEfficiency(data, toonOutput)
173
174 if (!toonRecommended) {
175 const hint =
176 savingsPercent <= 0
177 ? `Hint: JSON would be ${Math.abs(savingsPercent).toFixed(0)}% smaller for this data. ` +
178 'Consider --output json for better compatibility.'
179 : `Hint: TOON only saves ${savingsPercent.toFixed(0)}% over JSON for this data. ` +
180 'TOON works best with uniform arrays of objects (30-60% typical savings).'
181
182 console.error(cliChalk.dim(hint))
183 }
184 }
185}

Callers 8

output.test.tsFile · 0.90
createRunActionFunction · 0.90
dryRunDeepnoteProjectFunction · 0.90
runDeepnoteProjectFunction · 0.90
createInspectActionFunction · 0.90
outputInspectToonFunction · 0.90
outputAnalysisFunction · 0.90
handleErrorFunction · 0.90

Calls 1

analyzeToonEfficiencyFunction · 0.90

Tested by

no test coverage detected