I'd like to use Treeize (2.1.2) to make an array of homogeneous compound objects.
A simple example would be a product with many pricings. Each pricing is composed of a price and a segment. The latter two are in turn compound objects.
Here's my input:
let Treeize = require('treeize');
let tree = new Treeize();
let data = [
{
product_id: 1,
'pricings:price:value': 10,
'pricings:price:currency': 'USD',
'pricings:segment:id': 1,
'pricings:segment:name': 'Guest'
},
{
product_id: 1,
'pricings:price:value': 20,
'pricings:price:currency': 'USD',
'pricings:segment:id': 2,
'pricings:segment:name': 'Preferred'
}
];
tree = tree.grow(data);
I'd like to use Treeize (2.1.2) to make an array of homogeneous compound objects.
A simple example would be a product with many pricings. Each pricing is composed of a price and a segment. The latter two are in turn compound objects.
Here's my input:
However, running this example produces:
Segment and price are independent objects, and the array is heterogeneous. This isn't what I expected.
I can get the expected behavior by adding a dummy simple value to each pricing:
which yields:
Is what I'm seeing expected behavior, and if so, is there a way to override it?