Closed rhinoceraptor closed 7 years ago
Here is a minimal test case:
var treeize = require('treeize'); var tree = new treeize().setOptions({ output: { prune: false } }); var rows = [{ primaryKey: 1, subObject: { key: 'field' }, 'subresources:id': 1, 'subresources:field': 'Subresource 1', }, { primaryKey: 1, subObject: { key: 'field' }, 'subresources:id': 2, 'subresources:field': 'Subresource 2', }]; console.log(JSON.stringify(tree.grow(rows).getData(), null, 2))
In 2.0.2, this will output:
[ { "primaryKey": 1, "subObject": { "key": "field" }, "subresources": [ { "id": 1, "field": "Subresource 1" }, { "id": 2, "field": "Subresource 2" } ] } ]
In 2.1.0, this will output:
[ { "primaryKey": 1, "subObject": { "key": "field" }, "subresources": [ { "id": 1, "field": "Subresource 1" } ] }, { "primaryKey": 1, "subObject": { "key": "field" }, "subresources": [ { "id": 2, "field": "Subresource 2" } ] } ]
Solved in 2.1.1, and added your test case specifically to future coverage. Certainly an edge case I never anticipated!
👍
Here is a minimal test case:
In 2.0.2, this will output:
In 2.1.0, this will output: