* Compare this value to other one * @this {UUID} * @param {UUID} other Other value * @returns {number} 0 if they are the same, 1 if the this is greater and -1 if the given one is greater
(other)
| 282 | * @returns {number} 0 if they are the same, 1 if the this is greater and -1 if the given one is greater |
| 283 | */ |
| 284 | cmp (other) { |
| 285 | if (!UUID.isUUID(other)) { |
| 286 | return 1 |
| 287 | } |
| 288 | for (let i = 0; i < this.data.length; i++) { |
| 289 | let diff = this.data[i] - other.data[i] |
| 290 | if (diff !== 0) { |
| 291 | return diff |
| 292 | } |
| 293 | } |
| 294 | return 0 |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | Object.defineProperty(UUID.prototype, '__isUUID__', { value: true }) |