I currently have this code snippet in my function:
add(messenger) {
switch (messenger) {
case 'skype':
this.messengers = _.assign(this.messengers, {skype: ''})
break
case 'telegram':
this.messengers = _.assign(this.messengers, {telegram: ''})
break
}
}
Is there a way to refactor it and make it more concise? Perhaps like this:
add(messenger) {
this.messengers = _.assign(this.messengers, {messenger: ''})
},