| 123 | } |
| 124 | |
| 125 | compareMain (other) { |
| 126 | if (!(other instanceof SemVer)) { |
| 127 | other = new SemVer(other, this.options) |
| 128 | } |
| 129 | |
| 130 | if (this.major < other.major) { |
| 131 | return -1 |
| 132 | } |
| 133 | if (this.major > other.major) { |
| 134 | return 1 |
| 135 | } |
| 136 | if (this.minor < other.minor) { |
| 137 | return -1 |
| 138 | } |
| 139 | if (this.minor > other.minor) { |
| 140 | return 1 |
| 141 | } |
| 142 | if (this.patch < other.patch) { |
| 143 | return -1 |
| 144 | } |
| 145 | if (this.patch > other.patch) { |
| 146 | return 1 |
| 147 | } |
| 148 | return 0 |
| 149 | } |
| 150 | |
| 151 | comparePre (other) { |
| 152 | if (!(other instanceof SemVer)) { |