chore(cli): rename test files from .mts to .ts
This commit is contained in:
@@ -16,7 +16,17 @@ export function renderJson<T>(
|
||||
// Apply custom serializer if provided
|
||||
if (schema.serialize) {
|
||||
if (result.type === 'list') {
|
||||
// If all items serialize to the same object, return just one
|
||||
// This handles the case where a list of key-value rows should serialize
|
||||
// to a single structured object
|
||||
const serialized = result.data.map((item) => schema.serialize!(item))
|
||||
if (serialized.length > 0) {
|
||||
const first = JSON.stringify(serialized[0])
|
||||
const allSame = serialized.every((s) => JSON.stringify(s) === first)
|
||||
if (allSame) {
|
||||
return JSON.stringify(serialized[0], null, 2)
|
||||
}
|
||||
}
|
||||
return JSON.stringify(serialized, null, 2)
|
||||
} else {
|
||||
const serialized = schema.serialize(result.data)
|
||||
|
||||
Reference in New Issue
Block a user