@geospatial-sdk/core 0.0.5-dev.75 → 0.0.5-dev.76
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/dist/utils/hash.d.ts.map +1 -1
- package/dist/utils/hash.js +3 -0
- package/lib/utils/hash.test.ts +11 -0
- package/lib/utils/hash.ts +2 -0
- package/package.json +2 -2
package/dist/utils/hash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../lib/utils/hash.ts"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,GAAE,MAAM,EAAO,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../lib/utils/hash.ts"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,GAAE,MAAM,EAAO,GAAG,MAAM,CAsBzE"}
|
package/dist/utils/hash.js
CHANGED
|
@@ -21,6 +21,9 @@ export function getHash(input, ignoreKeys = []) {
|
|
|
21
21
|
.reduce((prev, curr) => (prev << 5) - prev + curr.charCodeAt(0), 0);
|
|
22
22
|
return (hash >>> 0).toString();
|
|
23
23
|
}
|
|
24
|
+
else if (typeof input === "bigint") {
|
|
25
|
+
return input.toString(10);
|
|
26
|
+
}
|
|
24
27
|
else {
|
|
25
28
|
return JSON.stringify(input);
|
|
26
29
|
}
|
package/lib/utils/hash.test.ts
CHANGED
|
@@ -129,4 +129,15 @@ describe("getHash", () => {
|
|
|
129
129
|
});
|
|
130
130
|
expect(hashB).not.toEqual(hashA);
|
|
131
131
|
});
|
|
132
|
+
it("supports bigint values", () => {
|
|
133
|
+
const hashA = getHash({
|
|
134
|
+
aa: "bb",
|
|
135
|
+
cc: 9007199254740991n,
|
|
136
|
+
});
|
|
137
|
+
const hashB = getHash({
|
|
138
|
+
aa: "bb",
|
|
139
|
+
cc: 9007199254740991n,
|
|
140
|
+
});
|
|
141
|
+
expect(hashB).toEqual(hashA);
|
|
142
|
+
});
|
|
132
143
|
});
|
package/lib/utils/hash.ts
CHANGED
|
@@ -19,6 +19,8 @@ export function getHash(input: unknown, ignoreKeys: string[] = []): string {
|
|
|
19
19
|
.split("")
|
|
20
20
|
.reduce((prev, curr) => (prev << 5) - prev + curr.charCodeAt(0), 0);
|
|
21
21
|
return (hash >>> 0).toString();
|
|
22
|
+
} else if (typeof input === "bigint") {
|
|
23
|
+
return input.toString(10);
|
|
22
24
|
} else {
|
|
23
25
|
return JSON.stringify(input);
|
|
24
26
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geospatial-sdk/core",
|
|
3
|
-
"version": "0.0.5-dev.
|
|
3
|
+
"version": "0.0.5-dev.76+7c756bf",
|
|
4
4
|
"description": "Core functions and models for the SDK",
|
|
5
5
|
"author": "Olivia <olivia.guyot@camptocamp.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test": "vitest",
|
|
23
23
|
"build": "tsc"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "7c756bfc0675a55cc1f641c8e80039787d75f0db",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"chroma-js": "^2.4.2",
|
|
28
28
|
"proj4": "^2.9.2"
|