(str = '')
| 19 | * @return {object} The original string and parsed object, { str, config }. |
| 20 | */ |
| 21 | export function getAndRemoveConfig(str = '') { |
| 22 | const config = {}; |
| 23 | |
| 24 | if (str) { |
| 25 | str = str |
| 26 | .replace(/^('|")/, '') |
| 27 | .replace(/('|")$/, '') |
| 28 | .replace(/(?:^|\s):([\w-]+:?)=?([\w-%]+)?/g, (m, key, value) => { |
| 29 | if (key.indexOf(':') === -1) { |
| 30 | config[key] = (value && value.replace(/"/g, '')) || true; |
| 31 | return ''; |
| 32 | } |
| 33 | |
| 34 | return m; |
| 35 | }) |
| 36 | .trim(); |
| 37 | } |
| 38 | |
| 39 | return { str, config }; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Remove the <a> tag from sidebar when the header with link, details see issue 1069 |
no outgoing calls
no test coverage detected
searching dependent graphs…