MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / cmp

Method cmp

projects/JavaScript/proto/uuid.js:284–295  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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
298Object.defineProperty(UUID.prototype, '__isUUID__', { value: true })

Callers 5

ltMethod · 0.95
lteMethod · 0.95
gtMethod · 0.95
gteMethod · 0.95
big.jsFile · 0.45

Calls 1

isUUIDMethod · 0.80

Tested by

no test coverage detected