@nxtedition/lib 20.0.9 → 20.1.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.
Files changed (3) hide show
  1. package/app.js +2 -0
  2. package/package.json +1 -1
  3. package/sequence.js +28 -1
package/app.js CHANGED
@@ -440,9 +440,11 @@ export function makeApp(appConfig, onTerminate) {
440
440
  stats$ = rxjs.timer(0, 10e3).pipe(rx.map(() => ({})))
441
441
  }
442
442
 
443
+ const startTime = Date.now()
443
444
  stats$ = stats$.pipe(
444
445
  rx.map((x) => ({
445
446
  ...x,
447
+ uptime: Date.now() - startTime,
446
448
  timestamp: Date.now(),
447
449
  })),
448
450
  rx.auditTime(1e3),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "20.0.9",
3
+ "version": "20.1.0",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
package/sequence.js CHANGED
@@ -24,9 +24,36 @@ export class Sequence {
24
24
  #parts = []
25
25
  #identity
26
26
 
27
+ // TODO (perf): Optimize
28
+ static compare(a, b) {
29
+ if (!a && !b) {
30
+ return 0
31
+ }
32
+
33
+ if (a && !b) {
34
+ return 1
35
+ }
36
+
37
+ if (!a && b) {
38
+ return -1
39
+ }
40
+
41
+ if (typeof a === 'string') {
42
+ a = new Sequence(a)
43
+ }
44
+
45
+ if (typeof b === 'string') {
46
+ b = new Sequence(b)
47
+ }
48
+
49
+ return a.compare(b)
50
+ }
51
+
27
52
  constructor(value, identity) {
28
53
  try {
29
- if (Array.isArray(value)) {
54
+ if (!value) {
55
+ this.#value = '0'
56
+ } else if (Array.isArray(value)) {
30
57
  for (const part of value) {
31
58
  if (typeof part === 'string') {
32
59
  const [sequenceStr, id] = part.split(ID_SEP)