How can I take a simple object with boolean values and convert it to an array where only those keys whose values are true end up in the array?
E.g.:
myObject = {
option1: true,
option2: false,
option3: true,
option4: true
}
becomes
['option1','option3','option4']
I tried using _.pick(myObject, Boolean)
as suggested here, but that simply produced an empty object. I'm using Typescript, so if there's any Typescript magic I can use to accomplish this, I'm up for that, too.