JSFiddle - React, Tailwind, and code Playground
by Robodude
JavaScript
const checkins1 = {
a: {
who: {
alias: "john"
},
in: true,
out: true
},
b: {
who: {
alias: "john"
},
in: true,
out: false
},
c: {
who: {
alias: "john"
},
in: true,
out: true
},
d: {
who: {
alias: "someone-else"
},
in: true,
out: false
}
}
const checkins2 = {
a: {
who: {
alias: "john"
},
in: true,
out: true
},
b: {
who: {
alias: "john"
},
in: true,
out: true
},
c: {
who: {
alias: "john"
},
in: true,
out: true
},
d: {
who: {
alias: "someone-else"
},
in: true,
out: false
}
}
console.log(Object.values(checkins1).some(p => p.who.alias === "john" && !p.out))
console.log(Object.values(checkins2).some(p => p.who.alias === "john" && !p.out))