(json: string)
| 454 | * Returns undefined if parsing fails. |
| 455 | */ |
| 456 | export function parseExtensionMessage(json: string): ExtensionMessage | undefined { |
| 457 | try { |
| 458 | const parsed = JSON.parse(json) |
| 459 | if (isValidExtensionMessage(parsed)) { |
| 460 | return parsed |
| 461 | } |
| 462 | return undefined |
| 463 | } catch { |
| 464 | return undefined |
| 465 | } |
| 466 | } |
| 467 | |
| 468 | /** |
| 469 | * Parse the text field of an api_req_started message. |
no test coverage detected