deepFindById
Traverse a graph, locating the first entry with an id
property that
has a specific string or number value
const l = {
one: {
two: [
{
id: "n001",
color: "red"
},
{
id: "n002",
color: "yellow"
}
]
}
};
const config = deepFindById(l, "n002")
//> {id: "n002", color:"yellow"}
This was designed to search a Site/Page/Project layout, and return the config for a card. There was some concern about the performance and using a real layout object, in the test, it takes ~1.5ms to do the search.
Parameters
Returns
any
Function defined in common/src/objects/deepFind.ts:37