| Total Complexity | 8 |
| Complexity/F | 4 |
| Lines of Code | 21 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | /** |
||
| 2 | * Split string/message to topic and choice |
||
| 3 | * reference: https://stackoverflow.com/a/18647776/2671470 |
||
| 4 | * |
||
| 5 | * @param {string} message - the new option name |
||
| 6 | * @returns {array} card |
||
| 7 | */ |
||
| 8 | export function splitMessage(message: string) { |
||
| 9 | const expression = /[^\s"]+|"([^"]*)"/gi; |
||
| 10 | const result = []; |
||
| 11 | let match; |
||
| 12 | do { |
||
| 13 | match = expression.exec(message); |
||
| 14 | if (match != null) { |
||
| 15 | result.push(match[1] ? match[1] : match[0]); |
||
| 16 | } |
||
| 17 | } while (match != null); |
||
| 18 | |||
| 19 | return result; |
||
| 20 | } |
||
| 21 |