@fluid-experimental/property-common 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229

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 (127) hide show
  1. package/.eslintrc.js +9 -11
  2. package/.mocharc.json +6 -6
  3. package/README.md +1 -0
  4. package/api-extractor.json +2 -2
  5. package/dist/chronometer.d.ts.map +1 -1
  6. package/dist/chronometer.js.map +1 -1
  7. package/dist/consoleUtils.d.ts.map +1 -1
  8. package/dist/consoleUtils.js +4 -1
  9. package/dist/consoleUtils.js.map +1 -1
  10. package/dist/constants.d.ts +6 -6
  11. package/dist/constants.d.ts.map +1 -1
  12. package/dist/constants.js +16 -26
  13. package/dist/constants.js.map +1 -1
  14. package/dist/datastructures/collection.d.ts.map +1 -1
  15. package/dist/datastructures/collection.js +5 -4
  16. package/dist/datastructures/collection.js.map +1 -1
  17. package/dist/datastructures/dataArray.d.ts.map +1 -1
  18. package/dist/datastructures/dataArray.js +18 -9
  19. package/dist/datastructures/dataArray.js.map +1 -1
  20. package/dist/datastructures/integer64.d.ts.map +1 -1
  21. package/dist/datastructures/integer64.js +1 -1
  22. package/dist/datastructures/integer64.js.map +1 -1
  23. package/dist/datastructures/sortedCollection.d.ts.map +1 -1
  24. package/dist/datastructures/sortedCollection.js +3 -1
  25. package/dist/datastructures/sortedCollection.js.map +1 -1
  26. package/dist/deferredPromise.d.ts +1 -1
  27. package/dist/deferredPromise.d.ts.map +1 -1
  28. package/dist/deferredPromise.js +9 -3
  29. package/dist/deferredPromise.js.map +1 -1
  30. package/dist/deterministicRandomGenerator.d.ts.map +1 -1
  31. package/dist/deterministicRandomGenerator.js +6 -6
  32. package/dist/deterministicRandomGenerator.js.map +1 -1
  33. package/dist/error_objects/flaggedError.d.ts.map +1 -1
  34. package/dist/error_objects/flaggedError.js.map +1 -1
  35. package/dist/error_objects/httpError.d.ts.map +1 -1
  36. package/dist/error_objects/httpError.js +9 -9
  37. package/dist/error_objects/httpError.js.map +1 -1
  38. package/dist/error_objects/httpErrorNoStack.d.ts.map +1 -1
  39. package/dist/error_objects/httpErrorNoStack.js.map +1 -1
  40. package/dist/error_objects/operationError.d.ts +7 -7
  41. package/dist/error_objects/operationError.d.ts.map +1 -1
  42. package/dist/error_objects/operationError.js +7 -7
  43. package/dist/error_objects/operationError.js.map +1 -1
  44. package/dist/guidUtils.d.ts.map +1 -1
  45. package/dist/guidUtils.js +10 -9
  46. package/dist/guidUtils.js.map +1 -1
  47. package/dist/hashCalculator.d.ts.map +1 -1
  48. package/dist/hashCalculator.js.map +1 -1
  49. package/dist/joinPaths.d.ts.map +1 -1
  50. package/dist/joinPaths.js.map +1 -1
  51. package/dist/packageVersion.d.ts +1 -1
  52. package/dist/packageVersion.js +1 -1
  53. package/dist/packageVersion.js.map +1 -1
  54. package/lib/chronometer.d.ts.map +1 -1
  55. package/lib/chronometer.js.map +1 -1
  56. package/lib/consoleUtils.d.ts.map +1 -1
  57. package/lib/consoleUtils.js +4 -1
  58. package/lib/consoleUtils.js.map +1 -1
  59. package/lib/constants.d.ts +6 -6
  60. package/lib/constants.d.ts.map +1 -1
  61. package/lib/constants.js +16 -26
  62. package/lib/constants.js.map +1 -1
  63. package/lib/datastructures/collection.d.ts.map +1 -1
  64. package/lib/datastructures/collection.js +5 -4
  65. package/lib/datastructures/collection.js.map +1 -1
  66. package/lib/datastructures/dataArray.d.ts.map +1 -1
  67. package/lib/datastructures/dataArray.js +18 -9
  68. package/lib/datastructures/dataArray.js.map +1 -1
  69. package/lib/datastructures/integer64.d.ts.map +1 -1
  70. package/lib/datastructures/integer64.js +1 -1
  71. package/lib/datastructures/integer64.js.map +1 -1
  72. package/lib/datastructures/sortedCollection.d.ts.map +1 -1
  73. package/lib/datastructures/sortedCollection.js +3 -1
  74. package/lib/datastructures/sortedCollection.js.map +1 -1
  75. package/lib/deferredPromise.d.ts +1 -1
  76. package/lib/deferredPromise.d.ts.map +1 -1
  77. package/lib/deferredPromise.js +9 -3
  78. package/lib/deferredPromise.js.map +1 -1
  79. package/lib/deterministicRandomGenerator.d.ts.map +1 -1
  80. package/lib/deterministicRandomGenerator.js +6 -6
  81. package/lib/deterministicRandomGenerator.js.map +1 -1
  82. package/lib/error_objects/flaggedError.d.ts.map +1 -1
  83. package/lib/error_objects/flaggedError.js.map +1 -1
  84. package/lib/error_objects/httpError.d.ts.map +1 -1
  85. package/lib/error_objects/httpError.js +9 -9
  86. package/lib/error_objects/httpError.js.map +1 -1
  87. package/lib/error_objects/httpErrorNoStack.d.ts.map +1 -1
  88. package/lib/error_objects/httpErrorNoStack.js.map +1 -1
  89. package/lib/error_objects/operationError.d.ts +7 -7
  90. package/lib/error_objects/operationError.d.ts.map +1 -1
  91. package/lib/error_objects/operationError.js +7 -7
  92. package/lib/error_objects/operationError.js.map +1 -1
  93. package/lib/guidUtils.d.ts.map +1 -1
  94. package/lib/guidUtils.js +10 -9
  95. package/lib/guidUtils.js.map +1 -1
  96. package/lib/hashCalculator.d.ts.map +1 -1
  97. package/lib/hashCalculator.js.map +1 -1
  98. package/lib/joinPaths.d.ts.map +1 -1
  99. package/lib/joinPaths.js.map +1 -1
  100. package/lib/packageVersion.d.ts +1 -1
  101. package/lib/packageVersion.js +1 -1
  102. package/lib/packageVersion.js.map +1 -1
  103. package/package.json +42 -40
  104. package/platform-dependent/README.md +1 -0
  105. package/platform-dependent/browser.js +5 -5
  106. package/platform-dependent/package.json +14 -14
  107. package/platform-dependent/server.js +5 -5
  108. package/prettier.config.cjs +1 -1
  109. package/src/chronometer.ts +174 -169
  110. package/src/consoleUtils.ts +16 -11
  111. package/src/constants.ts +1683 -1640
  112. package/src/datastructures/collection.ts +417 -416
  113. package/src/datastructures/dataArray.ts +516 -492
  114. package/src/datastructures/integer64.ts +102 -99
  115. package/src/datastructures/sortedCollection.ts +155 -145
  116. package/src/deferredPromise.ts +43 -42
  117. package/src/deterministicRandomGenerator.ts +59 -59
  118. package/src/error_objects/flaggedError.ts +29 -29
  119. package/src/error_objects/httpError.ts +45 -42
  120. package/src/error_objects/httpErrorNoStack.ts +17 -17
  121. package/src/error_objects/operationError.ts +62 -62
  122. package/src/guidUtils.ts +182 -171
  123. package/src/hashCalculator.ts +5 -2
  124. package/src/joinPaths.ts +15 -9
  125. package/src/packageVersion.ts +1 -1
  126. package/tsconfig.esnext.json +6 -6
  127. package/tsconfig.json +9 -13
package/src/guidUtils.ts CHANGED
@@ -21,74 +21,74 @@ const UINT_32HASH_PRIME = 16777619;
21
21
  * Page 357, algorithm name: Ranlim32
22
22
  */
23
23
  const guidRNG = {
24
- u: 0,
25
- v: 0,
26
- w1: 0,
27
- w2: 0,
28
- isInitialized: false,
29
-
30
- /**
31
- * Initialize RNG.
32
- * This function need to be called once, before the first GUID gets created.
33
- *
34
- * @param in_seed - Optional 32-bit seed for GUID RNG.
35
- * If no seed is given, a combination of system's local time and `Math.random()` is used.
36
- * @param in_enforceReInitialization - Optionally enforce re-initialization with another seed.
37
- *
38
- * @returns The seed used to initialize the RNG;
39
- * If re-initialization is not enforced, a zero indicates that the RNG was not re-seeded.
40
- *
41
- * @alias property-common.initializeGUIDGenerator
42
- */
43
- initialize(in_seed?: number, in_enforceReInitialization: boolean = false): number {
44
- // Quit if the RNG has already been initialized and we do not
45
- // want to enforce a re-initialization with a new seed
46
- if (this.isInitialized && !in_enforceReInitialization) {
47
- return 0;
48
- } else {
49
- this.isInitialized = true;
50
-
51
- if (in_seed === undefined) {
52
- const randomValues = generateRandomUInt32Array(4);
53
- this.u = randomValues[0];
54
- this.v = randomValues[1];
55
- this.w1 = randomValues[2];
56
- this.w2 = randomValues[3];
57
- } else {
58
- this.v = 224461437;
59
- this.w1 = 521288629;
60
- this.w2 = 362436069;
61
-
62
- this.u = in_seed ^ this.v;
63
- this.genRandUInt32();
64
- this.v = this.u;
65
- this.genRandUInt32();
66
- }
67
- return -1;
68
- }
69
- },
70
-
71
- /**
72
- * @returns 32-bit random number based on the RNGs internal state
73
- */
74
- genRandUInt32(): number {
75
- this.u = multiply_uint32(this.u, 2891336453) + 1640531513;
76
- this.v ^= this.v >>> 13;
77
- this.v ^= this.v << 17;
78
- this.v = ((this.v >>> 5) ^ this.v) >>> 0;
79
-
80
- this.w1 = multiply_uint32(33378, (this.w1 & 0xffff)) + (this.w1 >>> 16);
81
- this.w2 = multiply_uint32(57225, (this.w2 & 0xffff)) + (this.w2 >>> 16);
82
-
83
- let x = this.u ^ (this.u << 9);
84
- x ^= x >>> 17;
85
- x ^= x << 6;
86
-
87
- let y = this.w1 ^ (this.w1 << 17);
88
- y ^= y >>> 15;
89
- y ^= y << 5;
90
- return (((x >>> 0) + this.v) ^ ((y >>> 0) + this.w2)) >>> 0;
91
- },
24
+ u: 0,
25
+ v: 0,
26
+ w1: 0,
27
+ w2: 0,
28
+ isInitialized: false,
29
+
30
+ /**
31
+ * Initialize RNG.
32
+ * This function need to be called once, before the first GUID gets created.
33
+ *
34
+ * @param in_seed - Optional 32-bit seed for GUID RNG.
35
+ * If no seed is given, a combination of system's local time and `Math.random()` is used.
36
+ * @param in_enforceReInitialization - Optionally enforce re-initialization with another seed.
37
+ *
38
+ * @returns The seed used to initialize the RNG;
39
+ * If re-initialization is not enforced, a zero indicates that the RNG was not re-seeded.
40
+ *
41
+ * @alias property-common.initializeGUIDGenerator
42
+ */
43
+ initialize(in_seed?: number, in_enforceReInitialization: boolean = false): number {
44
+ // Quit if the RNG has already been initialized and we do not
45
+ // want to enforce a re-initialization with a new seed
46
+ if (this.isInitialized && !in_enforceReInitialization) {
47
+ return 0;
48
+ } else {
49
+ this.isInitialized = true;
50
+
51
+ if (in_seed === undefined) {
52
+ const randomValues = generateRandomUInt32Array(4);
53
+ this.u = randomValues[0];
54
+ this.v = randomValues[1];
55
+ this.w1 = randomValues[2];
56
+ this.w2 = randomValues[3];
57
+ } else {
58
+ this.v = 224461437;
59
+ this.w1 = 521288629;
60
+ this.w2 = 362436069;
61
+
62
+ this.u = in_seed ^ this.v;
63
+ this.genRandUInt32();
64
+ this.v = this.u;
65
+ this.genRandUInt32();
66
+ }
67
+ return -1;
68
+ }
69
+ },
70
+
71
+ /**
72
+ * @returns 32-bit random number based on the RNGs internal state
73
+ */
74
+ genRandUInt32(): number {
75
+ this.u = multiply_uint32(this.u, 2891336453) + 1640531513;
76
+ this.v ^= this.v >>> 13;
77
+ this.v ^= this.v << 17;
78
+ this.v = ((this.v >>> 5) ^ this.v) >>> 0;
79
+
80
+ this.w1 = multiply_uint32(33378, this.w1 & 0xffff) + (this.w1 >>> 16);
81
+ this.w2 = multiply_uint32(57225, this.w2 & 0xffff) + (this.w2 >>> 16);
82
+
83
+ let x = this.u ^ (this.u << 9);
84
+ x ^= x >>> 17;
85
+ x ^= x << 6;
86
+
87
+ let y = this.w1 ^ (this.w1 << 17);
88
+ y ^= y >>> 15;
89
+ y ^= y << 5;
90
+ return (((x >>> 0) + this.v) ^ ((y >>> 0) + this.w2)) >>> 0;
91
+ },
92
92
  };
93
93
 
94
94
  /**
@@ -108,13 +108,13 @@ const isBase64 = (GUID: string): boolean => GUID.length === 22;
108
108
  * @returns - result of unsigned integer multiplication
109
109
  */
110
110
  function multiply_uint32(a: number, b: number): number {
111
- let n = a;
112
- let m = b;
111
+ let n = a;
112
+ let m = b;
113
113
 
114
- n >>>= 0;
115
- m >>>= 0;
116
- const nlo = n & 0xffff;
117
- return (((n - nlo) * m >>> 0) + (nlo * m)) >>> 0;
114
+ n >>>= 0;
115
+ m >>>= 0;
116
+ const nlo = n & 0xffff;
117
+ return ((((n - nlo) * m) >>> 0) + nlo * m) >>> 0;
118
118
  }
119
119
 
120
120
  /**
@@ -124,7 +124,8 @@ function multiply_uint32(a: number, b: number): number {
124
124
  *
125
125
  * @returns Url-friendly base64 encoding.
126
126
  */
127
- const toUrlBase64 = (base64: string): string => base64.replace(/\+/g, "-").replace(/\//g, "_").split("=")[0];
127
+ const toUrlBase64 = (base64: string): string =>
128
+ base64.replace(/\+/g, "-").replace(/\//g, "_").split("=")[0];
128
129
 
129
130
  /**
130
131
  * Helper function to recover padding of base64 encoding
@@ -133,11 +134,11 @@ const toUrlBase64 = (base64: string): string => base64.replace(/\+/g, "-").repla
133
134
  *
134
135
  * @returns Padded base64 encoding.
135
136
  */
136
- const toPaddedBase64 = function(x: string): string {
137
- let base64 = x;
138
- const padLength = 4 - base64.length % 4;
139
- base64 += "=".repeat(padLength);
140
- return base64;
137
+ const toPaddedBase64 = function (x: string): string {
138
+ let base64 = x;
139
+ const padLength = 4 - (base64.length % 4);
140
+ base64 += "=".repeat(padLength);
141
+ return base64;
141
142
  };
142
143
 
143
144
  /**
@@ -148,23 +149,28 @@ const toPaddedBase64 = function(x: string): string {
148
149
  *
149
150
  * @returns The GUID
150
151
  */
151
- const uint32x4ToGUID = function(in_guidArray: Uint32Array | Int32Array | number[], base64: boolean = false): string {
152
- if (base64) {
153
- const intArray = new Uint32Array(in_guidArray);
154
- const byteArray = new Uint8Array(intArray.buffer);
155
- const base64guid = base64js.fromByteArray(byteArray);
156
- // return url-friendly base64
157
- return toUrlBase64(base64guid);
158
- } else {
159
- // Convert to hexadecimal string
160
- let str = "";
161
- for (let i = 0; i < 4; i++) {
162
- const hex = in_guidArray[i].toString(16);
163
- str += ("0".repeat(8 - hex.length) + hex);
164
- }
165
- // eslint-disable-next-line max-len
166
- return `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(16, 4)}-${str.substr(20, 12)}`;
167
- }
152
+ const uint32x4ToGUID = function (
153
+ in_guidArray: Uint32Array | Int32Array | number[],
154
+ base64: boolean = false,
155
+ ): string {
156
+ if (base64) {
157
+ const intArray = new Uint32Array(in_guidArray);
158
+ const byteArray = new Uint8Array(intArray.buffer);
159
+ const base64guid = base64js.fromByteArray(byteArray);
160
+ // return url-friendly base64
161
+ return toUrlBase64(base64guid);
162
+ } else {
163
+ // Convert to hexadecimal string
164
+ let str = "";
165
+ for (let i = 0; i < 4; i++) {
166
+ const hex = in_guidArray[i].toString(16);
167
+ str += "0".repeat(8 - hex.length) + hex;
168
+ }
169
+ return `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(
170
+ 16,
171
+ 4,
172
+ )}-${str.substr(20, 12)}`;
173
+ }
168
174
  };
169
175
 
170
176
  /**
@@ -176,19 +182,22 @@ const uint32x4ToGUID = function(in_guidArray: Uint32Array | Int32Array | number[
176
182
  * @returns Four 32-bit values
177
183
  *
178
184
  */
179
- const guidToUint32x4 = function(in_guid: string, result: Uint32Array = new Uint32Array(4)): Uint32Array {
180
- if (isBase64(in_guid)) {
181
- const GUID = toPaddedBase64(in_guid);
182
- const bytes = base64js.toByteArray(GUID);
183
- const intArray = new Uint32Array(bytes.buffer);
184
- result.set(intArray);
185
- } else {
186
- result[0] = parseInt(`0x${in_guid.substr(0, 8)}`, 16);
187
- result[1] = parseInt(`0x${in_guid.substr(9, 4)}${in_guid.substr(14, 4)}`, 16);
188
- result[2] = parseInt(`0x${in_guid.substr(19, 4)}${in_guid.substr(24, 4)}`, 16);
189
- result[3] = parseInt(`0x${in_guid.substr(28, 8)}`, 16);
190
- }
191
- return result;
185
+ const guidToUint32x4 = function (
186
+ in_guid: string,
187
+ result: Uint32Array = new Uint32Array(4),
188
+ ): Uint32Array {
189
+ if (isBase64(in_guid)) {
190
+ const GUID = toPaddedBase64(in_guid);
191
+ const bytes = base64js.toByteArray(GUID);
192
+ const intArray = new Uint32Array(bytes.buffer);
193
+ result.set(intArray);
194
+ } else {
195
+ result[0] = parseInt(`0x${in_guid.substr(0, 8)}`, 16);
196
+ result[1] = parseInt(`0x${in_guid.substr(9, 4)}${in_guid.substr(14, 4)}`, 16);
197
+ result[2] = parseInt(`0x${in_guid.substr(19, 4)}${in_guid.substr(24, 4)}`, 16);
198
+ result[3] = parseInt(`0x${in_guid.substr(28, 8)}`, 16);
199
+ }
200
+ return result;
192
201
  };
193
202
 
194
203
  /**
@@ -220,23 +229,23 @@ const base16ToBase64 = (in_guid: string) => uint32x4ToGUID(guidToUint32x4(in_gui
220
229
  *
221
230
  * @returns The GUID
222
231
  */
223
- const generateGUID = function(base64 = false): string {
224
- const rnds = new Uint32Array(4);
225
-
226
- // Random numbers for GUID (4x32 bit)
227
- rnds[0] = guidRNG.genRandUInt32();
228
- rnds[1] = guidRNG.genRandUInt32();
229
- rnds[2] = guidRNG.genRandUInt32();
230
- rnds[3] = guidRNG.genRandUInt32();
231
- return uint32x4ToGUID(rnds, base64);
232
+ const generateGUID = function (base64 = false): string {
233
+ const rnds = new Uint32Array(4);
234
+
235
+ // Random numbers for GUID (4x32 bit)
236
+ rnds[0] = guidRNG.genRandUInt32();
237
+ rnds[1] = guidRNG.genRandUInt32();
238
+ rnds[2] = guidRNG.genRandUInt32();
239
+ rnds[3] = guidRNG.genRandUInt32();
240
+ return uint32x4ToGUID(rnds, base64);
232
241
  };
233
242
 
234
243
  // The last character is checked this way because last 4 bits of 22nd character are ignored
235
244
  // by decoder, e.g. "+Q" and "+Z" result in the same decoding.
236
245
  // The only characters with last 4 bits set to 0 are A, Q, g, w.
237
- const reBase64 = (/^[\w-]{21}[AQgw]$/);
246
+ const reBase64 = /^[\w-]{21}[AQgw]$/;
238
247
  // eslint-disable-next-line unicorn/no-unsafe-regex
239
- const reBase16 = (/^[\dA-Fa-f]{8}(?:-[\dA-Fa-f]{4}){3}-[\dA-Fa-f]{12}$/);
248
+ const reBase16 = /^[\dA-Fa-f]{8}(?:-[\dA-Fa-f]{4}){3}-[\dA-Fa-f]{12}$/;
240
249
 
241
250
  /**
242
251
  * Routine used to check whether the given string is a valid GUID
@@ -254,42 +263,42 @@ const isGUID = (in_guid: string) => reBase16.test(in_guid) || reBase64.test(in_g
254
263
  * @param in_array2 - Second array
255
264
  * @returns New combined hash
256
265
  */
257
- const hashCombine4xUint32 = function(
258
- in_array1: Uint32Array,
259
- in_array2: Uint32Array,
260
- io_result?: Uint32Array,
266
+ const hashCombine4xUint32 = function (
267
+ in_array1: Uint32Array,
268
+ in_array2: Uint32Array,
269
+ io_result?: Uint32Array,
261
270
  ): Uint32Array {
262
- let accumulated = io_result;
263
- if (accumulated === undefined) {
264
- accumulated = new Uint32Array(in_array2);
265
- } else {
266
- accumulated[0] = in_array2[0];
267
- accumulated[1] = in_array2[1];
268
- accumulated[2] = in_array2[2];
269
- accumulated[3] = in_array2[3];
270
- }
271
-
272
- accumulated[0] += 0x9e3779b9;
273
- accumulated[1] += 0x638f227;
274
- accumulated[2] += 0x1aff2bad;
275
- accumulated[3] += 0x3a8f05c5;
276
-
277
- accumulated[0] += in_array1[3] << 6;
278
- accumulated[1] += in_array1[0] << 6;
279
- accumulated[2] += in_array1[1] << 6;
280
- accumulated[3] += in_array1[2] << 6;
281
-
282
- accumulated[0] += in_array1[2] >> 2;
283
- accumulated[1] += in_array1[3] >> 2;
284
- accumulated[2] += in_array1[0] >> 2;
285
- accumulated[3] += in_array1[1] >> 2;
286
-
287
- accumulated[0] = ((accumulated[0] ^ in_array1[1]) * UINT_32HASH_PRIME) >>> 0;
288
- accumulated[1] = ((accumulated[1] ^ in_array1[2]) * UINT_32HASH_PRIME) >>> 0;
289
- accumulated[2] = ((accumulated[2] ^ in_array1[3]) * UINT_32HASH_PRIME) >>> 0;
290
- accumulated[3] = ((accumulated[3] ^ in_array1[0]) * UINT_32HASH_PRIME) >>> 0;
291
-
292
- return accumulated;
271
+ let accumulated = io_result;
272
+ if (accumulated === undefined) {
273
+ accumulated = new Uint32Array(in_array2);
274
+ } else {
275
+ accumulated[0] = in_array2[0];
276
+ accumulated[1] = in_array2[1];
277
+ accumulated[2] = in_array2[2];
278
+ accumulated[3] = in_array2[3];
279
+ }
280
+
281
+ accumulated[0] += 0x9e3779b9;
282
+ accumulated[1] += 0x638f227;
283
+ accumulated[2] += 0x1aff2bad;
284
+ accumulated[3] += 0x3a8f05c5;
285
+
286
+ accumulated[0] += in_array1[3] << 6;
287
+ accumulated[1] += in_array1[0] << 6;
288
+ accumulated[2] += in_array1[1] << 6;
289
+ accumulated[3] += in_array1[2] << 6;
290
+
291
+ accumulated[0] += in_array1[2] >> 2;
292
+ accumulated[1] += in_array1[3] >> 2;
293
+ accumulated[2] += in_array1[0] >> 2;
294
+ accumulated[3] += in_array1[1] >> 2;
295
+
296
+ accumulated[0] = ((accumulated[0] ^ in_array1[1]) * UINT_32HASH_PRIME) >>> 0;
297
+ accumulated[1] = ((accumulated[1] ^ in_array1[2]) * UINT_32HASH_PRIME) >>> 0;
298
+ accumulated[2] = ((accumulated[2] ^ in_array1[3]) * UINT_32HASH_PRIME) >>> 0;
299
+ accumulated[3] = ((accumulated[3] ^ in_array1[0]) * UINT_32HASH_PRIME) >>> 0;
300
+
301
+ return accumulated;
293
302
  };
294
303
 
295
304
  /**
@@ -303,26 +312,28 @@ const hashCombine4xUint32 = function(
303
312
  * @param base64 - Use base64 encoding instead of standart GUIDs
304
313
  * @returns Combined GUID
305
314
  */
306
- const combineGuids = function(in_guid1: string, in_guid2: string, base64 = false): string {
307
- const firstArray = guidToUint32x4(in_guid1);
308
- const secondArray = guidToUint32x4(in_guid2);
309
- const combined = hashCombine4xUint32(firstArray, secondArray);
310
- return uint32x4ToGUID(combined, base64);
315
+ const combineGuids = function (in_guid1: string, in_guid2: string, base64 = false): string {
316
+ const firstArray = guidToUint32x4(in_guid1);
317
+ const secondArray = guidToUint32x4(in_guid2);
318
+ const combined = hashCombine4xUint32(firstArray, secondArray);
319
+ return uint32x4ToGUID(combined, base64);
311
320
  };
312
321
 
313
322
  // Make sure the RNG is initialized
314
323
  guidRNG.initialize();
315
324
 
316
- const initializeGUIDGenerator = (...args) => { guidRNG.initialize(...args); };
325
+ const initializeGUIDGenerator = (...args) => {
326
+ guidRNG.initialize(...args);
327
+ };
317
328
 
318
329
  export const GuidUtils = {
319
- uint32x4ToGUID,
320
- guidToUint32x4,
321
- base64Tobase16,
322
- base16ToBase64,
323
- initializeGUIDGenerator,
324
- generateGUID,
325
- isGUID,
326
- combineGuids,
327
- hashCombine4xUint32,
330
+ uint32x4ToGUID,
331
+ guidToUint32x4,
332
+ base64Tobase16,
333
+ base16ToBase64,
334
+ initializeGUIDGenerator,
335
+ generateGUID,
336
+ isGUID,
337
+ combineGuids,
338
+ hashCombine4xUint32,
328
339
  };
@@ -11,6 +11,9 @@
11
11
  import murmurHash3 from "murmurhash3js";
12
12
 
13
13
  export function calculateHash(key, seed = 0) {
14
- const str = murmurHash3.x86.hash128(key, seed);
15
- return `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(16, 4)}-${str.substr(20, 12)}`;
14
+ const str = murmurHash3.x86.hash128(key, seed);
15
+ return `${str.substr(0, 8)}-${str.substr(8, 4)}-${str.substr(12, 4)}-${str.substr(
16
+ 16,
17
+ 4,
18
+ )}-${str.substr(20, 12)}`;
16
19
  }
package/src/joinPaths.ts CHANGED
@@ -17,14 +17,20 @@
17
17
  *
18
18
  * @returns The joined path
19
19
  */
20
- export function joinPaths(in_string1: string = "", in_string2: string = "", in_separator: string = "/"): string {
21
- let separator = in_separator;
20
+ export function joinPaths(
21
+ in_string1: string = "",
22
+ in_string2: string = "",
23
+ in_separator: string = "/",
24
+ ): string {
25
+ let separator = in_separator;
22
26
 
23
- if (!in_string1 ||
24
- !in_string2 ||
25
- in_string1.substr(-in_separator.length) === in_separator ||
26
- in_string2.substr(0, in_separator.length) === in_separator) {
27
- separator = "";
28
- }
29
- return in_string1 + separator + in_string2;
27
+ if (
28
+ !in_string1 ||
29
+ !in_string2 ||
30
+ in_string1.substr(-in_separator.length) === in_separator ||
31
+ in_string2.substr(0, in_separator.length) === in_separator
32
+ ) {
33
+ separator = "";
34
+ }
35
+ return in_string1 + separator + in_string2;
30
36
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluid-experimental/property-common";
9
- export const pkgVersion = "2.0.0-dev.2.3.0.115467";
9
+ export const pkgVersion = "2.0.0-dev.4.1.0.148229";
@@ -1,7 +1,7 @@
1
1
  {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./lib",
5
- "module": "esnext"
6
- },
7
- }
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./lib",
5
+ "module": "esnext",
6
+ },
7
+ }
package/tsconfig.json CHANGED
@@ -1,14 +1,10 @@
1
1
  {
2
- "extends": "@fluidframework/build-common/ts-common-config.json",
3
- "compilerOptions": {
4
- "composite": true,
5
- "rootDir": "./src",
6
- "outDir": "./dist"
7
- },
8
- "include": [
9
- "src/**/*"
10
- ],
11
- "exclude": [
12
- "src/test/**/*"
13
- ]
14
- }
2
+ "extends": "@fluidframework/build-common/ts-common-config.json",
3
+ "compilerOptions": {
4
+ "composite": true,
5
+ "rootDir": "./src",
6
+ "outDir": "./dist",
7
+ },
8
+ "include": ["src/**/*"],
9
+ "exclude": ["src/test/**/*"],
10
+ }