I wanted to have a switch/case statement that accepts an object in Javascript.
The function looks like this.
const validate = (values) => { valu
const switchCase=(obj={},str='')=>obj[Object.keys(obj).find(ele=>ele.toString().split('|').includes(str.toString())) || 'default'] console.log(switchCase({ default:'o', 40:'ko', xyz:'hi', 'yi|th' :'ho' },'yi'))