@dcl/ecs 7.1.2-4409365701.commit-a58c7a5 → 7.1.2-4415683908.commit-0a210fd

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.
@@ -23,18 +23,25 @@ export function dataCompare(a, b) {
23
23
  if (a !== null && b === null)
24
24
  return 1;
25
25
  if (a instanceof Uint8Array && b instanceof Uint8Array) {
26
+ const lengthDifference = a.byteLength - b.byteLength;
27
+ if (lengthDifference !== 0) {
28
+ return lengthDifference > 0 ? 1 : -1;
29
+ }
26
30
  let res;
27
- const n = a.byteLength > b.byteLength ? b.byteLength : a.byteLength;
28
- for (let i = 0; i < n; i++) {
31
+ for (let i = 0, n = a.byteLength; i < n; i++) {
29
32
  res = a[i] - b[i];
30
33
  if (res !== 0) {
31
34
  return res > 0 ? 1 : -1;
32
35
  }
33
36
  }
34
- res = a.byteLength - b.byteLength;
35
- return res > 0 ? 1 : res < 0 ? -1 : 0;
37
+ // the data is exactly the same
38
+ return 0;
36
39
  }
37
40
  if (typeof a === 'string') {
41
+ const lengthDifference = a.length - b.length;
42
+ if (lengthDifference !== 0) {
43
+ return lengthDifference > 0 ? 1 : -1;
44
+ }
38
45
  return a.localeCompare(b);
39
46
  }
40
47
  return a > b ? 1 : -1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcl/ecs",
3
- "version": "7.1.2-4409365701.commit-a58c7a5",
3
+ "version": "7.1.2-4415683908.commit-0a210fd",
4
4
  "description": "Decentraland ECS",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./dist/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "ts-proto": "^1.112.0"
28
28
  },
29
29
  "dependencies": {
30
- "@dcl/js-runtime": "7.1.2-4409365701.commit-a58c7a5",
30
+ "@dcl/js-runtime": "7.1.2-4415683908.commit-0a210fd",
31
31
  "@dcl/protocol": "1.0.0-4408137944.commit-a67c796"
32
32
  },
33
33
  "files": [
@@ -40,5 +40,5 @@
40
40
  "displayName": "ECS",
41
41
  "tsconfig": "./tsconfig.json"
42
42
  },
43
- "commit": "a58c7a50276b3c778b15a7480b2b78abd0eaa1d0"
43
+ "commit": "0a210fde7524e27f44b8cc35d8fabf39705c57b6"
44
44
  }