socket-function 0.61.0 → 0.63.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 -4
- package/src/misc.ts +7 -0
- package/time/trueTimeShim.ts +3 -0
package/package.json
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "socket-function",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
|
|
7
6
|
"dependencies": {
|
|
8
7
|
"@types/pako": "^2.0.3",
|
|
9
8
|
"@types/ws": "^8.5.3",
|
|
10
9
|
"cbor-x": "^1.6.0",
|
|
11
10
|
"mobx": "^6.6.2",
|
|
12
|
-
"node-forge": "https://github.com/sliftist/forge#name",
|
|
13
11
|
"pako": "^2.1.0",
|
|
14
12
|
"preact": "10.24.3",
|
|
15
13
|
"typenode": "^5.7.0",
|
|
@@ -22,7 +20,6 @@
|
|
|
22
20
|
},
|
|
23
21
|
"devDependencies": {
|
|
24
22
|
"@types/cookie": "^0.5.1",
|
|
25
|
-
"@types/node-forge": "^1.3.1",
|
|
26
23
|
"debugbreak": "^0.6.5",
|
|
27
24
|
"pegjs": "^0.10.0",
|
|
28
25
|
"typedev": "^0.1.3"
|
package/src/misc.ts
CHANGED
|
@@ -377,6 +377,13 @@ export function compare(lhs: unknown, rhs: unknown): number {
|
|
|
377
377
|
if (lhs as any < (rhs as any)) return -1;
|
|
378
378
|
return 1;
|
|
379
379
|
}
|
|
380
|
+
export function compareArray(lhs: unknown[], rhs: unknown[]): number {
|
|
381
|
+
for (let i = 0; i < Math.min(lhs.length, rhs.length); i++) {
|
|
382
|
+
let comparison = compare(lhs[i], rhs[i]);
|
|
383
|
+
if (comparison !== 0) return comparison;
|
|
384
|
+
}
|
|
385
|
+
return lhs.length - rhs.length;
|
|
386
|
+
}
|
|
380
387
|
|
|
381
388
|
export function insertIntoSortedList<T>(list: T[], map: (val: T) => string | number, element: T) {
|
|
382
389
|
let searchValue = map(element);
|
package/time/trueTimeShim.ts
CHANGED
|
@@ -60,6 +60,9 @@ export function waitForFirstTimeSync() {
|
|
|
60
60
|
export function shimDateNow() {
|
|
61
61
|
Date.now = getTrueTime;
|
|
62
62
|
}
|
|
63
|
+
export function getBrowserTime() {
|
|
64
|
+
return baseGetTime();
|
|
65
|
+
}
|
|
63
66
|
|
|
64
67
|
export function setGetTimeOffsetBase(base: () => Promise<number>) {
|
|
65
68
|
getTimeOffsetBase = base;
|