You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
demoncord-rewrite/src/api/utils/object.ts

17 lines
430 B

function getByChildProps(obj: UnknownObject, prop: string): UnknownObject {
let m: UnknownObject = {};
Object.values(obj).forEach(e => {
switch (typeof e) {
case "object":
if (Object.keys(e).includes(prop) || Object.values(e).includes(prop)) {
m = e
return
}
}
})
return m
}
export default {
getByChildProps
}