JavaScript - Flatten Array of Nested Objects - javascript

I am working with an array of objects and need to flatten and re-assign the data set into an array of single objects using the object values as the new object keys.
Incoming Data:
results = [
{
surveyValues: [
{ id: 135, name: 'First Name', value: 'Jim' },
{ id: 136, name: 'Last Name', value: 'Jones' },
{ id: 137, name: 'City', value: 'Fredsburg' },
],
},
{
surveyValues: [
{ id: 135, name: 'First Name', value: 'Greg' },
{ id: 136, name: 'Last Name', value: 'Jones' },
{ id: 137, name: 'City', value: 'Waverly' },
],
},
];
Desired Result:
output = [
{
id: 1, FirstName: 'Jim', LastName: 'Jones', City: 'Fredsburg',
},
{
id: 2, FirstName: 'Greg', LastName: 'Jones', City: 'Waverly',
},
];
My current attempt gets me to placing the updated key/value pairs in the correct order, but creates a huge array of single objects.
Current Code:
const results = [];
surveyResults.map(s => s.surveyValues)
.forEach(s => Object.entries(s)
.forEach(([key, value]) => {
Object.entries(value)
.forEach(([k, v]) => {
if (k === 'name') {
results.push({
id: value.id,
[v]: value.value.toString(),
});
}
});
}));
Current Code Output:
[
{
id: 135, FirstName: 'Jim',
},
{
id: 136, LastName: 'Jones',
},
{
id: 137, City: 'Fredsburg',
},
{
id: 135, FirstName: 'Greg',
},
{
id: 136, LastName: 'Jones',
},
{
id: 137, City: 'Waverly',
},
]
What am I missing and why is my code not created the new arrays of objects as desired?

You may use map and reduce to accomplish this. I'm also accessing an index i in the map function's callback to set the id property and string.replace() to strip the space from the FirstName and LastName keys.
const results = [
{
surveyValues: [
{ id: 135, name: 'First Name', value: 'Jim' },
{ id: 136, name: 'Last Name', value: 'Jones' },
{ id: 137, name: 'City', value: 'Fredsburg' },
],
},
{
surveyValues: [
{ id: 135, name: 'First Name', value: 'Greg' },
{ id: 136, name: 'Last Name', value: 'Jones' },
{ id: 137, name: 'City', value: 'Waverly' },
],
},
];
const result = results.map((e, i) =>
e.surveyValues.reduce((a, e) => {
a[e.name.replace(" ", "")] = e.value;
return a;
}, {id: i + 1})
);
console.log(result);

Create each object in the outer map() loop, and add properties to it in the inner forEach().
surveyResults = [
{
surveyValues: [
{ id: 135, name: 'First Name', value: 'Jim' },
{ id: 136, name: 'Last Name', value: 'Jones' },
{ id: 137, name: 'City', value: 'Fredsburg' },
],
},
{
surveyValues: [
{ id: 135, name: 'First Name', value: 'Greg' },
{ id: 136, name: 'Last Name', value: 'Jones' },
{ id: 137, name: 'City', value: 'Waverly' },
],
},
];
const results = surveyResults.map((s, i) => {
let v = s.surveyValues;
let obj = {id: i};
v.forEach(item => obj[item.name.replace(/\s+/g, "")] = item.value.toString());
return obj;
});
console.log(results);

Related

How to change object value in array with objects with if/else in JS

I have an array with objects. I need to find item with current name and change it.
const example = [
{
id: '1234',
desc: 'sample1',
items: [
itemsName: [
{ id: 1, name: 'name1' },
{ id: 2, name: 'testItem2' }
],
id: 888,
]
},
{
id: '3456',
desc: 'sample2',
items: [
itemsName: [
{ id: 1, name: 'name2' },
{ id: 2, name: 'testItem3' }
],
id: 889,
]
},
I try to do in this way, but it's not working.
I get construction like (5) 
[Array(1), Array(1)]
instead of 
[{…}, {…}]
const findName = (name, changedName) => {
const result = example?.map((group) =>
group.items.map((group) =>
group.itemsName?.map((i) => {
if (i.name === name) return i.name === changedName;
return null;
})
)
);
}
findName('name1', 'name2')
let findName1 = (name, changedName) => {
const result = example?.map((group) =>
group.items.map((group) =>
group.itemsName?.map((i) => {
if (i.name === name) return i.name = changedName;
return null;
})
)
);
}
This will work with following object (your object declaration seems to be wrong)
const example = [
{
id: '1234',
desc: 'sample1',
items: [
{itemsName: [
{ id: 1, name: 'name1' },
{ id: 2, name: 'testItem2' }
],
id: 888,}
]
},
{
id: '3456',
desc: 'sample2',
items: [
{itemsName: [
{ id: 1, name: 'name2' },
{ id: 2, name: 'testItem3' }
],
id: 889,}
]
}]

Merge array of objects preserving some key-values php

Consider the following two arrays:
[
{
id: jhz,
name: 'John',
eyes: 'Green',
description: 'Cool guy',
},
{
id: mbe,
name: 'Mary',
brand: 'M&B',
text: 'Something',
}
]
[
{
id: jhz,
name: 'John',
eyes: '',
},
{
id: mbe,
name: 'Mary',
},
{
id: 'beh',
name: 'Bernard',
}
]
First array may have any kind of key value pairs, but it will always have the key id and name. I want to merge the two arrays by taking id and name into account and preserving them, while merging everything else and replacing them with data from the first array if any keys duplicate.
Also tricky part - the merged array needs to follow the order of the second array.
So in this example the result I'm looking for is:
[
{
id: jhz,
name: 'John',
eyes: 'Green',
description: 'Cool guy',
},
{
id: mbe,
name: 'Mary',
brand: 'M&B',
text: 'Something',
},
{
id: 'beh',
name: 'Bernard',
}
]
you can do something like this using Array.map
const data1 = [{
id: 'jhz',
name: 'John',
eyes: 'Green',
description: 'Cool guy',
},
{
id: 'mbe',
name: 'Mary',
brand: 'M&B',
text: 'Something',
}
]
const data2 = [{
id: 'jhz',
name: 'John',
eyes: '',
},
{
id: 'mbe',
name: 'Mary',
},
{
id: 'beh',
name: 'Bernard',
}
]
const result = data2.map(d => ({...d, ...(data1.find(d1 => d1.id === d.id && d1.name === d.name) || {})}))
console.log(result)

How to return the array of intersection between two array with Lodash?

I am trying to return the array of all the intersected array elements.
I got 2 arrays.
The array from api and the filter condition array.
Array from api is this
let somethingList = [
{
id: 'PROD108',
name: 'Headsweats Mid Cap',
CustomFields: [
{
name: 'Brand',
value: 'Headsweats',
},
{
name: 'Eco',
value: 'False',
},
{
name: 'Test',
value: '0',
},
],
},
{
id: 'PROD109',
name: 'Performance Liberty City Cycling Cap',
CustomFields: [
{
name: 'Brand',
value: 'Performance',
},
{
name: 'Eco',
value: 'False',
},
{
name: 'Test',
value: '0',
},
],
},
{
id: 'PROD110',
name: 'Castelli Logo Bandana',
CustomFields: [
{
name: 'Brand',
value: 'Castelli',
},
{
name: 'Eco',
value: 'False',
},
{
name: 'Test',
value: '0',
},
],
},
{
id: 'PROD159',
name: 'Performance Classic Sleeveless Jersey',
CustomFields: [
{
name: 'Eco',
value: 'False',
},
{
name: 'Color',
value: '#4CAF50',
},
{
name: 'Test',
value: '0',
},
],
},
{
id: 'PROD160',
name: 'Schwinn Evolution IC Sleeveless Jersey',
CustomFields: [
{
name: 'Brand',
value: 'Schwinn',
},
{
name: 'Eco',
value: 'False',
},
{
name: 'Color',
value: '#2196F3',
},
{
name: 'Test',
value: '0',
},
],
},
{
id: 'PROD161',
name: 'Performance Elite Short',
CustomFields: [
{
name: 'Brand',
value: 'Performance',
},
{
name: 'Eco',
value: 'False',
},
{
name: 'Color',
value: '#000000',
},
{
name: 'Test',
value: '0',
},
],
},
{
id: 'PROD162',
name: 'Andiamo! Padded Cycling Brief',
CustomFields: [
{
name: 'Eco',
value: 'False',
},
{
name: 'Color',
value: '#808080',
},
{
name: 'Test',
value: '0',
},
],
},
{
id: 'PROD163',
name: 'Fox Mojave Glove',
CustomFields: [
{
name: 'Brand',
value: 'Fox',
},
{
name: 'Eco',
value: 'False',
},
{
name: 'Color',
value: '#000000',
},
{
name: 'Test',
value: '0',
},
],
},
];
filter condition array.
let testingFilter = ['Fox', 'Performance'];
What I want to do is if the customfield value of array from api is intersected with testingFilter value
I want to push them into an array and return that new array.
But the code I written don't return an new array, What should I do to return a new array
let filteredProduct = [];
filteredProduct = _.filter(somethingList, (product) => {
if (testingFilter.length === 0) {
return somethingList;
} else {
// Here is the problem
return _.intersection(testingFilter, _.map(product.CustomFields, 'value'));
}
});
Expected Answer array
filteredProduct = [
{
id: 'PROD109',
name: 'Performance Liberty City Cycling Cap',
CustomFields: [
{
name: 'Brand',
value: 'Performance',
},
{
name: 'Eco',
value: 'False',
},
{
name: 'Test',
value: '0',
},
],
},
{
id: 'PROD161',
name: 'Performance Elite Short',
CustomFields: [
{
name: 'Brand',
value: 'Performance',
},
{
name: 'Eco',
value: 'False',
},
{
name: 'Color',
value: '#000000',
},
{
name: 'Test',
value: '0',
},
],
},
{
id: 'PROD163',
name: 'Fox Mojave Glove',
CustomFields: [
{
name: 'Brand',
value: 'Fox',
},
{
name: 'Eco',
value: 'False',
},
{
name: 'Color',
value: '#000000',
},
{
name: 'Test',
value: '0',
},
],
},
]
The following line taken from your code:
_.map(product.CustomFields, 'value')
Here, you get an array of all the values's of the CustomFields, if we check if there is an item from testinFilter present in that array, we can use that as the _filter return statement like so:
let filteredProduct = [];
filteredProduct = _.filter(somethingList, (product) => {
const allCustomFields = _.map(product.CustomFields, 'value');
return allCustomFields.some(r => testingFilter.indexOf(r) >= 0);
});
// We could rewrite the same code as a one-liner without the extra const like so:
let filteredProduct = _.filter(somethingList, (product) => _.map(product.CustomFields, 'value').some(r => testingFilter.indexOf(r) >= 0));
Snippet:
let testingFilter = ['Fox', 'Performance'];
let somethingList = [{id: 'PROD108', name: 'Headsweats Mid Cap', CustomFields: [{name: 'Brand', value: 'Headsweats', }, {name: 'Eco', value: 'False', }, {name: 'Test', value: '0', }, ], }, {id: 'PROD109', name: 'Performance Liberty City Cycling Cap', CustomFields: [{name: 'Brand', value: 'Performance', }, {name: 'Eco', value: 'False', }, {name: 'Test', value: '0', }, ], }, {id: 'PROD110', name: 'Castelli Logo Bandana', CustomFields: [{name: 'Brand', value: 'Castelli', }, {name: 'Eco', value: 'False', }, {name: 'Test', value: '0', }, ], }, {id: 'PROD159', name: 'Performance Classic Sleeveless Jersey', CustomFields: [{name: 'Eco', value: 'False', }, {name: 'Color', value: '#4CAF50', }, {name: 'Test', value: '0', }, ], }, {id: 'PROD160', name: 'Schwinn Evolution IC Sleeveless Jersey', CustomFields: [{name: 'Brand', value: 'Schwinn', }, {name: 'Eco', value: 'False', }, {name: 'Color', value: '#2196F3', }, {name: 'Test', value: '0', }, ], }, {id: 'PROD161', name: 'Performance Elite Short', CustomFields: [{name: 'Brand', value: 'Performance', }, {name: 'Eco', value: 'False', }, {name: 'Color', value: '#000000', }, {name: 'Test', value: '0', }, ], }, {id: 'PROD162', name: 'Andiamo! Padded Cycling Brief', CustomFields: [{name: 'Eco', value: 'False', }, {name: 'Color', value: '#808080', }, {name: 'Test', value: '0', }, ], }, {id: 'PROD163', name: 'Fox Mojave Glove', CustomFields: [{name: 'Brand', value: 'Fox', }, {name: 'Eco', value: 'False', }, {name: 'Color', value: '#000000', }, {name: 'Test', value: '0', }, ], }, ];
let filteredProduct = _.filter(somethingList, (product) => {
const allCustomFields = _.map(product.CustomFields, 'value');
return allCustomFields.some(r => testingFilter.indexOf(r) >= 0);
});
console.log(filteredProduct);
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
Result:
[
{
"id": "PROD109",
"name": "Performance Liberty City Cycling Cap",
"CustomFields": [
{
"name": "Brand",
"value": "Performance"
},
{
"name": "Eco",
"value": "False"
},
{
"name": "Test",
"value": "0"
}
]
},
{
"id": "PROD161",
"name": "Performance Elite Short",
"CustomFields": [
{
"name": "Brand",
"value": "Performance"
},
{
"name": "Eco",
"value": "False"
},
{
"name": "Color",
"value": "#000000"
},
{
"name": "Test",
"value": "0"
}
]
},
{
"id": "PROD163",
"name": "Fox Mojave Glove",
"CustomFields": [
{
"name": "Brand",
"value": "Fox"
},
{
"name": "Eco",
"value": "False"
},
{
"name": "Color",
"value": "#000000"
},
{
"name": "Test",
"value": "0"
}
]
}
]
You can do:
let somethingList = [ { id: 'PROD108', name: 'Headsweats Mid Cap', CustomFields: [ { name: 'Brand', value: 'Headsweats', }, { name: 'Eco', value: 'False', }, { name: 'Test', value: '0', }, ], }, { id: 'PROD109', name: 'Performance Liberty City Cycling Cap', CustomFields: [ { name: 'Brand', value: 'Performance', }, { name: 'Eco', value: 'False', }, { name: 'Test', value: '0', }, ], }, { id: 'PROD110', name: 'Castelli Logo Bandana', CustomFields: [ { name: 'Brand', value: 'Castelli', }, { name: 'Eco', value: 'False', }, { name: 'Test', value: '0', }, ], }, { id: 'PROD159', name: 'Performance Classic Sleeveless Jersey', CustomFields: [ { name: 'Eco', value: 'False', }, { name: 'Color', value: '#4CAF50', }, { name: 'Test', value: '0', }, ], }, { id: 'PROD160', name: 'Schwinn Evolution IC Sleeveless Jersey', CustomFields: [ { name: 'Brand', value: 'Schwinn', }, { name: 'Eco', value: 'False', }, { name: 'Color', value: '#2196F3', }, { name: 'Test', value: '0', }, ], }, { id: 'PROD161', name: 'Performance Elite Short', CustomFields: [ { name: 'Brand', value: 'Performance', }, { name: 'Eco', value: 'False', }, { name: 'Color', value: '#000000', }, { name: 'Test', value: '0', }, ], }, { id: 'PROD162', name: 'Andiamo! Padded Cycling Brief', CustomFields: [ { name: 'Eco', value: 'False', }, { name: 'Color', value: '#808080', }, { name: 'Test', value: '0', }, ], }, { id: 'PROD163', name: 'Fox Mojave Glove', CustomFields: [ { name: 'Brand', value: 'Fox', }, { name: 'Eco', value: 'False', }, { name: 'Color', value: '#000000', }, { name: 'Test', value: '0', }, ], }, ];
let testingFilter = ['Fox', 'Performance'];
let filteredProducts = somethingList.filter(p =>
Array.from(p.CustomFields.values()) // iterable to array
.map(({value}) => value)
.some(value => testingFilter.includes(value)))
console.log(filteredProducts)

Compare values in two arrays of obj and remove from first

var firstOne = [
{ id: 22, value: 'hi there' },
{ id: 28, value: 'here' },
{ id: 77, value: 'what' }
];
var secondOne = [
{ id: 2, value: 'bond' },
{ id: 8, value: 'foobar' },
{ id: 87, value: 'what' }
];
I'm looking for the best approach to compare two arrays of objects by value. If value is same in both, then remove it from firstOne which would result in:
var firstOne = [
{ id: 22, value: 'hi there' },
{ id: 28, value: 'here' }
];
var secondOne = [
{ id: 2, value: 'bond' },
{ id: 8, value: 'foobar' },
{ id: 87, value: 'what' }
];
Javascript or Angular solutions would be appreciated. Thanks
You could use Set for the filtering.
var firstOne = [{ id: 22, value: 'hi there' }, { id: 28, value: 'here' }, { id: 77, value: 'what' }],
secondOne = [{ id: 2, value: 'bond' }, { id: 8, value: 'foobar' }, { id: 87, value: 'what' }],
mySet = new Set;
secondOne.forEach(function (a) {
mySet.add(a.value);
});
firstOne = firstOne.filter(function (a) {
return !mySet.has(a.value);
});
console.log(firstOne);
ES6
var firstOne = [{ id: 22, value: 'hi there' }, { id: 28, value: 'here' }, { id: 77, value: 'what' }],
secondOne = [{ id: 2, value: 'bond' }, { id: 8, value: 'foobar' }, { id: 87, value: 'what' }],
mySet = new Set;
secondOne.forEach(a => mySet.add(a.value));
firstOne = firstOne.filter(a => !mySet.has(a.value));
console.log(firstOne);

Find / delete / add / update objects in nested json

I have a problem with finding object in nested json! I need to do operations like 'add' to object and 'delete' object in that nested json. Would it be easy to get object by using "JSON.stringify" and in that string find objects ID parameter (every object has its own unique ID). Then from that point find its "wrapper" curly braces ({}) i could get object it self and then delete it or add new object in it.
I had this idea, but have no idea how to select its curly braces... I think it might work, but what do you thing? :)
Here would be the example object! https://jsfiddle.net/gb8hb8g7/
var aa = [
{name: "aaa",
id: 1,
items: [
{name: "bbb",
id: 15,
items: [
{name: "ccc",
id: 44},
{name: "ddd",
id: 91}
]},
{name: "eee",
id: 12}
]
}
];
console.log(JSON.stringify(aa));
You can traverse the nested JSON recursively, to perform the operations you need.
var aa = [
{name: "aaa",
id: 1,
items: [
{name: "bbb",
id: 15,
items: [
{name: "ccc",
id: 44},
{name: "ddd",
id: 91}
]},
{name: "eee",
id: 12}
]
}
];
var fff = {name: "fff", id: 13};
addObj(aa, 91, fff); // Add obj to same array as item 91
chgObj(aa, 91, '^', 'name', 'zzz'); // Change 'name' property of item 91
chgObj(aa, 91, '+', 'other', 'test'); // Add property to item 91
chgObj(aa, 91, '+', 'gone', 'delete me'); // Add property to item 91
chgObj(aa, 91, '-', 'gone'); // Delete property from item 91
dltObj(aa, 44); // Delete item 44
function addObj(itemArr, nId, newObj) {
for (var i = 0; i < itemArr.length; i++) {
if (itemArr[i].id && itemArr[i].id === nId) {
itemArr.push(newObj);
} else {
if (itemArr[i].items) {
addObj(itemArr[i].items, nId, newObj);
}
}
}
}
function chgObj(itemArr, nId, operator, prop, val) {
for (var i = 0; i < itemArr.length; i++) {
if (itemArr[i].id && itemArr[i].id === nId) {
switch (operator) {
case '+':
if (!itemArr[i][prop]) {
itemArr[i][prop] = val;
}
break;
case '-':
if (itemArr[i][prop]) {
delete itemArr[i][prop];
}
break;
case '^':
if (itemArr[i][prop]) {
itemArr[i][prop] = val;
}
break;
}
} else {
if (itemArr[i].items) {
chgObj(itemArr[i].items, nId, operator, prop, val);
}
}
}
}
function dltObj(itemArr, nId) {
for (var i = 0; i < itemArr.length; i++) {
if (itemArr[i].id && itemArr[i].id === nId) {
itemArr.splice(i, 1);
} else {
if (itemArr[i].items) {
dltObj(itemArr[i].items, nId);
}
}
}
}
alert(JSON.stringify(aa));
new fiddle: https://jsfiddle.net/ta4pjqew/2
You should be able to just use your objects like you are traversing a big array:
var aa = [
{name: "aaa",
id: 1,
items: [
{name: "bbb",
id: 15,
items: [
{name: "ccc",
id: 44},
{name: "ddd",
id: 91}
]},
{name: "eee",
id: 12}
]
}
];
aa[0].name = 'abc';
aa[0].newprop = 23;
console.log(aa[0].items[0].items[1]);
delete aa[0].items[0].items[1];
console.log(aa[0].items[0].items[1]);
console.log(JSON.stringify(aa));
Take a look at object-scan. Makes it every easy to write clean and maintainable code to modify complex data structures. Here is how one could answer your question.
// const objectScan = require('object-scan');
const tool = (() => {
const scanner = objectScan(['**.items[*]'], {
abort: true,
rtn: 'bool',
filterFn: ({ value, parent, property, context }) => {
if (value.id === context.id) {
context.fn({ value, parent, property });
return true;
}
return false;
}
});
return {
add: (data, id, obj) => scanner(data, { id, fn: ({ parent, property }) => parent.splice(property + 1, 0, obj) }),
del: (data, id) => scanner(data, { id, fn: ({ parent, property }) => parent.splice(property, 1) }),
mod: (data, id, prop, v = undefined) => scanner(data, {
id,
fn: ({ value }) => {
if (value !== undefined) {
value[prop] = v;
} else {
delete value[prop];
}
}
})
};
})();
// -------------------------------
const aa = [{ name: 'aaa', id: 1, items: [ { name: 'bbb', id: 15, items: [ { name: 'ccc', id: 44 }, { name: 'ddd', id: 91 } ] }, { name: 'eee', id: 12 } ] }];
const fff = { name: 'fff', id: 13 };
const exec = (fn) => {
console.log('---------------');
console.log(fn.toString());
console.log(fn());
console.log(aa);
};
exec(() => tool.add(aa, 91, fff)); // Add obj to array after item 91
exec(() => tool.mod(aa, 91, 'name', 'zzz')); // Change 'name' property of item 91
exec(() => tool.mod(aa, 91, 'other', 'test')); // Add property to item 91
exec(() => tool.mod(aa, 91, 'gone', 'delete me')); // Add property to item 91
exec(() => tool.mod(aa, 91, 'gone')); // Delete property from item 91
exec(() => tool.del(aa, 44)); // Delete item 44
// => ---------------
// => () => tool.add(aa, 91, fff)
// => true
// => [ { name: 'aaa', id: 1, items: [ { name: 'bbb', id: 15, items: [ { name: 'ccc', id: 44 }, { name: 'ddd', id: 91 }, { name: 'fff', id: 13 } ] }, { name: 'eee', id: 12 } ] } ]
// => ---------------
// => () => tool.mod(aa, 91, 'name', 'zzz')
// => true
// => [ { name: 'aaa', id: 1, items: [ { name: 'bbb', id: 15, items: [ { name: 'ccc', id: 44 }, { name: 'zzz', id: 91 }, { name: 'fff', id: 13 } ] }, { name: 'eee', id: 12 } ] } ]
// => ---------------
// => () => tool.mod(aa, 91, 'other', 'test')
// => true
// => [ { name: 'aaa', id: 1, items: [ { name: 'bbb', id: 15, items: [ { name: 'ccc', id: 44 }, { name: 'zzz', id: 91, other: 'test' }, { name: 'fff', id: 13 } ] }, { name: 'eee', id: 12 } ] } ]
// => ---------------
// => () => tool.mod(aa, 91, 'gone', 'delete me')
// => true
// => [ { name: 'aaa', id: 1, items: [ { name: 'bbb', id: 15, items: [ { name: 'ccc', id: 44 }, { name: 'zzz', id: 91, other: 'test', gone: 'delete me' }, { name: 'fff', id: 13 } ] }, { name: 'eee', id: 12 } ] } ]
// => ---------------
// => () => tool.mod(aa, 91, 'gone')
// => true
// => [ { name: 'aaa', id: 1, items: [ { name: 'bbb', id: 15, items: [ { name: 'ccc', id: 44 }, { name: 'zzz', id: 91, other: 'test', gone: undefined }, { name: 'fff', id: 13 } ] }, { name: 'eee', id: 12 } ] } ]
// => ---------------
// => () => tool.del(aa, 44)
// => true
// => [ { name: 'aaa', id: 1, items: [ { name: 'bbb', id: 15, items: [ { name: 'zzz', id: 91, other: 'test', gone: undefined }, { name: 'fff', id: 13 } ] }, { name: 'eee', id: 12 } ] } ]
.as-console-wrapper {max-height: 100% !important; top: 0}
<script src="https://bundle.run/object-scan#13.8.0"></script>
Disclaimer: I'm the author of object-scan

Categories