@nxtedition/lib 27.1.1 → 27.1.2

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/sequence.js +9 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "27.1.1",
3
+ "version": "27.1.2",
4
4
  "license": "UNLICENSED",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
@@ -94,5 +94,5 @@
94
94
  "pino": ">=7.0.0",
95
95
  "rxjs": "^7.0.0"
96
96
  },
97
- "gitHead": "f31799349f12959956951384782db57a5af14e64"
97
+ "gitHead": "70732eb2cd3e69e3e131287f631bb919672110d4"
98
98
  }
package/sequence.js CHANGED
@@ -132,16 +132,10 @@ export class Sequence {
132
132
  {
133
133
  let count = 0
134
134
  for (let n = 0; n < this.#parts.length; n += 2) {
135
- const id = this.#parts[n + 0]
136
- if (typeof id !== 'string' || id.length === 0) {
137
- throw new Error('invalid identity part')
138
- }
139
-
140
135
  const sequence = this.#parts[n + 1]
141
136
  if (!Number.isInteger(sequence) || sequence < 0) {
142
137
  throw new Error('invalid sequence part')
143
138
  }
144
-
145
139
  count += sequence
146
140
  }
147
141
 
@@ -150,6 +144,15 @@ export class Sequence {
150
144
  }
151
145
  }
152
146
 
147
+ if (this.#identity == null) {
148
+ for (let n = 0; n < this.#parts.length; n += 2) {
149
+ const id = this.#parts[n + 0]
150
+ if (typeof id !== 'string' || (id.length === 0 && !this.#identity)) {
151
+ throw new Error('invalid identity part')
152
+ }
153
+ }
154
+ }
155
+
153
156
  if (identity != null) {
154
157
  if (typeof identity === 'number') {
155
158
  assert(identity === this.identity)