(rest, flag)
| 117 | } |
| 118 | |
| 119 | function takeFlag(rest, flag) { |
| 120 | const pattern = new RegExp(`(^|\\s)${escapeRegExp(flag)}(?=\\s|$)`, "i") |
| 121 | const found = pattern.test(rest) |
| 122 | return [found, rest.replace(pattern, " ").replace(/\s+/g, " ").trim()] |
| 123 | } |
| 124 | |
| 125 | function takeFlagValue(rest, flag) { |
| 126 | const pattern = new RegExp(`(^|\\s)${escapeRegExp(flag)}\\s+(?:\"([^\"]*)\"|'([^']*)'|(\\S+))`, "i") |
| 127 | const match = rest.match(pattern) |
| 128 | if (!match) return [undefined, rest] |
no test coverage detected