I can't figure out to convert a string formatted like:
"'keyTest'=>'valueTest', 'keyTest2'=>'valueTest2',..."
to a Map object simply. I can do it with foreach but i wonder if there is a prettier way ?
I can do it like so :
let linksMap = new Map<string, string>();
family.links.split(',').forEach((element) => {
const keyVal = element.split('=>');
linksMap.set(keyVal[0], keyVal[1]);
});
Is there a way to cast directly or something like that ?
You can use a
Mapconstructor