| 150 | export type Core = Pick<SemVer, "major" | "minor" | "patch" | "prerelease"> |
| 151 | |
| 152 | const comparePrerelease = ( |
| 153 | self: ReadonlyArray<string | number>, |
| 154 | that: ReadonlyArray<string | number> |
| 155 | ): -1 | 0 | 1 => { |
| 156 | if (self.length === 0) return that.length === 0 ? 0 : 1 |
| 157 | if (that.length === 0) return -1 |
| 158 | const length = Math.min(self.length, that.length) |
| 159 | for (let i = 0; i < length; i++) { |
| 160 | const a = self[i] |
| 161 | const b = that[i] |
| 162 | if (a === b) continue |
| 163 | if (typeof a === "number") return typeof b === "number" ? order.Number(a, b) : -1 |
| 164 | if (typeof b === "number") return 1 |
| 165 | return order.String(a, b) |
| 166 | } |
| 167 | return order.Number(self.length, that.length) |
| 168 | } |
| 169 | |
| 170 | /** @internal */ |
| 171 | export const sameCore = (self: Core, that: Core): boolean => |