I think we still can use power of regex that also handles the cases like "- key: value" i.e. array and map at the same line that isn't covered by **extractKey** at this moment (and we need a test case for that).

match = /^(?:-\s+)?(.+):(?:\s|$)/.exec(value.trim());
return match ? match[1] : '';