@nxtedition/lib 21.4.2 → 21.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/sequence.js +12 -1
package/package.json
CHANGED
package/sequence.js
CHANGED
|
@@ -60,6 +60,11 @@ export class Sequence {
|
|
|
60
60
|
const sequence = parseInt(sequenceStr)
|
|
61
61
|
assert(Number.isFinite(sequence) && sequence >= 0)
|
|
62
62
|
this.#parts.push(id, sequence)
|
|
63
|
+
} else if (typeof part === 'number') {
|
|
64
|
+
assert(Number.isFinite(part) && part >= 0)
|
|
65
|
+
assert(Number.isFinite(identity))
|
|
66
|
+
this.#parts.push('', part)
|
|
67
|
+
this.#identity = identity
|
|
63
68
|
} else {
|
|
64
69
|
assert(Number.isFinite(part.sequence) && part.sequence >= 0)
|
|
65
70
|
assert(typeof part.id === 'string' && part.id.length > 0)
|
|
@@ -128,8 +133,14 @@ export class Sequence {
|
|
|
128
133
|
}
|
|
129
134
|
}
|
|
130
135
|
|
|
131
|
-
compare(other) {
|
|
136
|
+
compare(other, strict) {
|
|
137
|
+
if (strict === undefined) {
|
|
138
|
+
strict = true
|
|
139
|
+
}
|
|
140
|
+
|
|
132
141
|
assert(other instanceof Sequence)
|
|
142
|
+
assert(typeof strict === 'boolean')
|
|
143
|
+
assert(!strict && other.identity === this.identity)
|
|
133
144
|
|
|
134
145
|
if (this.#parts.length !== other.#parts.length) {
|
|
135
146
|
return this.#parts.length - other.#parts.length
|