If I have an object parent like this, and an object with every field name is the ID which include the array like childs. How can I do to have clone the parent become children with different attritube as the result I mention below?
var parent = {
    'Name': 'Product ABC',
}
var attributes = {
    // AttributeId : Name
    'ID0001': ['Black', 'Red'],
    'ID0002': ['Small', 'Medium', 'Large'],
    'ID0003': ['Cotton', 'Len']
}
The children cloned should be
{
    'Name': 'Product ABC', // Same as parent
    'Attributes': [ // Black - Small - Cotton
        {'AttributeId':'ID0001', value:'Black'},
        {'AttributeId':'ID0002', value:'Small'}
        {'AttributeId':'ID0003', value:'Cotton'}
    ]
},
{
    'Name': 'Product ABC', // Same as parent
    'Attributes': [ // Red - Small - Cotton
        {'AttributeId':'ID0001', value:'Red'},
        {'AttributeId':'ID0002', value:'Small'}
        {'AttributeId':'ID0003', value:'Cotton'}
    ]
},
{
    'Name': 'Product ABC', // Same as parent
    'Attributes': [ // Black - Medium - Cotton
        {'AttributeId':'ID0001', value:'Black'},
        {'AttributeId':'ID0002', value:'Medium'}
        {'AttributeId':'ID0003', value:'Cotton'}
    ]
}
.....
P/S It seem to hard to understand the values rule of the children generated. Here is my description: children is cloned to become full of atributes in the 'attributes' object that include some arrays, but it unique atribute. like 'Black - Small - Cotton', 'Red - Small - Cotton', 'Black - Medium - Cotton', 'Black - Medium - Len', ...
 
     
    