@barefootjs/go-template 0.5.3 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/go-template-adapter.d.ts +5 -2
- package/dist/adapter/go-template-adapter.d.ts.map +1 -1
- package/dist/adapter/index.js +104 -23
- package/dist/build.js +104 -23
- package/dist/index.js +104 -23
- package/package.json +2 -2
- package/src/__tests__/go-template-adapter.test.ts +199 -18
- package/src/adapter/go-template-adapter.ts +213 -22
- package/src/test-render.ts +8 -1
package/src/test-render.ts
CHANGED
|
@@ -355,7 +355,14 @@ function goMapLiteralFromObject(
|
|
|
355
355
|
else if (typeof v === 'number') entries.push(`${key}: ${v}`)
|
|
356
356
|
else if (typeof v === 'boolean') entries.push(`${key}: ${v}`)
|
|
357
357
|
else if (v === null) entries.push(`${key}: nil`)
|
|
358
|
-
else if (
|
|
358
|
+
else if (Array.isArray(v)) {
|
|
359
|
+
// Array-valued field inside an object-in-array (e.g. the `tags`
|
|
360
|
+
// of `items.flatMap(i => i.tags)`). Without this branch the field
|
|
361
|
+
// was silently dropped, leaving an empty map so the template
|
|
362
|
+
// rendered nothing for the projection (#1448 Tier C flatMap).
|
|
363
|
+
entries.push(`${key}: ${goArrayLiteralFromArray(v)}`)
|
|
364
|
+
}
|
|
365
|
+
else if (v && typeof v === 'object') {
|
|
359
366
|
entries.push(`${key}: ${goMapLiteralFromObject(v as Record<string, unknown>, capitalizeKeys)}`)
|
|
360
367
|
}
|
|
361
368
|
}
|