FilteredText array needs to check all its objects and their properties. If the property is different then it becames "Mixed data".
The Output should look like this:
filteredText = [
{
innerHTML: 'Hello World',
fontSize: 'Mixed data',
fontWeight: '700',
},
{
innerHTML: 'Hello World',
fontSize: 'Mixed data',
fontWeight: '400',
},
{
innerHTML: 'Hello World',
fontSize: 'Mixed data',
fontWeight: '400',
},
]
let baseData = [
{
input_text1: "{'innerHTML': 'Hello World', 'fontSize': '5', 'fontWeight': '700'}",
input_text2: "{'innerHTML': 'Hello World', 'fontSize': '5', 'fontWeight': '400'}",
input_text3: "{'innerHTML': 'Hello World', 'fontSize': '5', 'fontWeight': '400'}",
input_shape1: "{x: 7, y, 150, width: 50, height: 50}",
input_shape2: "{x: 150, y, 80, width: 50, height: 50}",
input_shape3: "{x: 67, y, 150, width: 50, height: 50}",
},
{
input_text1: "{'innerHTML': 'Hello World', 'fontSize': '10', 'fontWeight': '700'}",
input_text2: "{'innerHTML': 'Hello World', 'fontSize': '5', 'fontWeight': '400'}",
input_text3: "{'innerHTML': 'Hello World', 'fontSize': '5', 'fontWeight': '400'}",
input_shape1: "{x: 50, y, 150, width: 50, height: 50}",
input_shape2: "{x: 150, y, 80, width: 50, height: 50}",
input_shape3: "{x: 30, y, 150, width: 50, height: 50}",
},
{
input_text1: "{'innerHTML': 'Hello World', 'fontSize': '5', 'fontWeight': '700'}",
input_text2: "{'innerHTML': 'Hello World', 'fontSize': '5', 'fontWeight': '400'}",
input_text3: "{'innerHTML': 'Hello World', 'fontSize': '5', 'fontWeight': '400'}",
input_shape1: "{x: 7, y, 150, width: 50, height: 50}",
input_shape2: "{x: 150, y, 50, width: 50, height: 50}",
input_shape3: "{x: 67, y, 150, width: 50, height: 50}",
},
]
let filteredText = baseData.map(el => {
return Object.entries(el).filter(key => key[0].includes('text'))
});