JSFiddle - React, Tailwind, and code Playground
by tara5
JavaScript
var object = {
"Ob1": {
"id": 1,
"name": "Ob1",
"properties": {
"attName": "A1",
"attType": "string",
"attOccurance": "minOccurs=\"1\""
},
"Ob2": {
"id": 101,
"name": "Ob2",
"properties": {
"attName": "B1",
"attType": "string",
"attOccurance": "minOccurs=\"1\""
},
"Ob3": {
"id": 10001,
"name": "Ob3",
"properties": {
"attName": "C1",
"attType": "string",
"attOccurance": "minOccurs=\"1\""
},
},
"Ob4": {
"id": 10002,
"name": "Ob4",
"properties": {
"attName": "C2",
"attType": "string",
"attOccurance": "minOccurs=\"1\""
},
},
},
"Ob5": {
"id": 102,
"name": "Ob5",
"properties": {
"attName": "B2",
"attType": "string",
"attOccurance": "minOccurs=\"1\""
},
"Ob6": {
"id": 10003,
"name": "Ob6",
"properties": {
"attName": "C3",
"attType": "string",
"attOccurance": "minOccurs=\"1\""
},
},
},
},
"Ob7": {
"id": 2,
"name": "Ob7",
"properties": {
"attName": "A2",
"attType": "string",
"attOccurance": "minOccurs=\"1\""
}
}
}
function doesObjectHaveEmbeddedObjects(obj) {
return Object.keys(obj).find(function(key) {
return isComplexObject(key, obj);
});
}
function isComplexObject(key, obj) {
return (key !== "properties") && (typeof obj[key] ===...