Similar to chmod, I would like to use 1, 2, 4 as a way of notifications.
1 = Email
2 = SMS
4 = Push notifications
Is there function (preferably in javascript) that can input a number (above) and can return an object with:
{
email: true,
sms: true,
push: false
}
I want the function to not be hard coded. I don't want a bunch of if statements that check for every combination there is. I want a "smart" way to do it.