(metastring: string)
| 10 | * ``` |
| 11 | */ |
| 12 | export function parseMetastring(metastring: string): ParsedMetastring { |
| 13 | if (!metastring) { |
| 14 | return {}; |
| 15 | } |
| 16 | |
| 17 | const argv = parse(metastring); |
| 18 | const result: ParsedMetastring = {}; |
| 19 | argv.forEach(arg => { |
| 20 | if (!arg.includes("=")) { |
| 21 | if (arg === "showNumbers") { |
| 22 | result["showNumbers"] = true; |
| 23 | } else { |
| 24 | result.focus = arg; |
| 25 | } |
| 26 | } else { |
| 27 | const [key, value] = arg.split(/=(.*)/); |
| 28 | if (value === "true") { |
| 29 | result[key] = true; |
| 30 | } else { |
| 31 | result[key] = value; |
| 32 | } |
| 33 | } |
| 34 | }); |
| 35 | return result; |
| 36 | } |
no outgoing calls
no test coverage detected