I'm struggling to convert a string that looks like this:
"'keyTest'=>'valueTest', 'keyTest2'=>'valueTest2',..."
into a Map object easily. I can achieve it using forEach, but I'm wondering if there is a more elegant solution?
Here's how I currently do it:
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 directly cast or something similar to streamline this process?