So I have a large object thats is similar in structure to this:
var obj = {
'1': {
name: "Naruto Uzumaki",
series: "Naruto"
},
'2': {
name: "Sasuke Uchiha",
series: "Naruto"
},
'3': {
name: "Edward Elric",
series: "Fullmetal Alchemist"
},
'4': {
name: "Alphonse Elric",
series: "Fullmetal Alchemist"
}
}
I'd like to know how I can search via name or series and return the ids of the responses. For example:
//I search for Fullmetal Alchemist it should return this:
['3', '4']
//I search for Naruto Uzumaki it returns
['1']
//I search for Elric it returns
['3', '4']
//And I search for Naruto it returns
['1', '2']
So basically im looking for a search function to look through all of the nested objects.
I'd also like to note im doing this in a nodejs enviroment.