(version: string)
| 199 | |
| 200 | export default class TestUtils { |
| 201 | static parseVersionNumber(version: string): Array<number> { |
| 202 | if (version === 'latest' || version === 'edge') return [Infinity]; |
| 203 | |
| 204 | |
| 205 | // Match complete version number patterns |
| 206 | const versionMatch = version.match(/(^|-)\d+(\.\d+)*($|-)/); |
| 207 | if (!versionMatch) { |
| 208 | throw new TypeError(`${version} is not a valid redis version`); |
| 209 | } |
| 210 | |
| 211 | // Extract just the numbers and dots between first and last dash (or start/end) |
| 212 | const versionNumbers = versionMatch[0].replace(/^-|-$/g, ''); |
| 213 | |
| 214 | return versionNumbers.split('.').map(x => { |
| 215 | const value = Number(x); |
| 216 | if (Number.isNaN(value)) { |
| 217 | throw new TypeError(`${version} is not a valid redis version`); |
| 218 | } |
| 219 | return value; |
| 220 | }); |
| 221 | } |
| 222 | static #getVersion( |
| 223 | tagArgumentName: string, |
| 224 | versionArgumentName: string | undefined, |
no outgoing calls
no test coverage detected