(str)
| 124 | * @returns {SemVerRangeItem[]} |
| 125 | */ |
| 126 | const parsePartial = (str) => { |
| 127 | const match = |
| 128 | /** @type {RegExpExecArray} */ |
| 129 | (/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(str)); |
| 130 | /** @type {SemVerRangeItem[]} */ |
| 131 | const ver = match[1] ? [0, ...splitAndConvert(match[1])] : [0]; |
| 132 | |
| 133 | if (match[2]) { |
| 134 | ver.length++; |
| 135 | ver.push.apply(ver, splitAndConvert(match[2])); |
| 136 | } |
| 137 | |
| 138 | // remove trailing any matchers |
| 139 | let last = ver[ver.length - 1]; |
| 140 | while ( |
| 141 | ver.length && |
| 142 | (last === undefined || /^[*xX]$/.test(/** @type {string} */ (last))) |
| 143 | ) { |
| 144 | ver.pop(); |
| 145 | last = ver[ver.length - 1]; |
| 146 | } |
| 147 | |
| 148 | return ver; |
| 149 | }; |
| 150 | |
| 151 | /** |
| 152 | * Returns the sem ver range item. |
no test coverage detected