@geospatial-sdk/core 0.0.5-alpha.1
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/LICENSE +28 -0
- package/README.md +11 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/model/index.d.ts +3 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +2 -0
- package/dist/model/map-context-diff.d.ts +35 -0
- package/dist/model/map-context-diff.d.ts.map +1 -0
- package/dist/model/map-context-diff.js +1 -0
- package/dist/model/map-context.d.ts +78 -0
- package/dist/model/map-context.d.ts.map +1 -0
- package/dist/model/map-context.js +1 -0
- package/dist/utils/freeze.d.ts +2 -0
- package/dist/utils/freeze.d.ts.map +1 -0
- package/dist/utils/freeze.js +15 -0
- package/dist/utils/freeze.test.d.ts +2 -0
- package/dist/utils/freeze.test.d.ts.map +1 -0
- package/dist/utils/freeze.test.js +51 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/map-context-diff.d.ts +25 -0
- package/dist/utils/map-context-diff.d.ts.map +1 -0
- package/dist/utils/map-context-diff.js +111 -0
- package/dist/utils/map-context-diff.test.d.ts +2 -0
- package/dist/utils/map-context-diff.test.d.ts.map +1 -0
- package/dist/utils/map-context-diff.test.js +370 -0
- package/dist/utils/url.d.ts +7 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/url.js +17 -0
- package/dist/utils/url.test.d.ts +2 -0
- package/dist/utils/url.test.d.ts.map +1 -0
- package/dist/utils/url.test.js +8 -0
- package/lib/index.ts +3 -0
- package/lib/model/index.ts +2 -0
- package/lib/model/map-context-diff.ts +37 -0
- package/lib/model/map-context.ts +96 -0
- package/lib/utils/freeze.test.ts +52 -0
- package/lib/utils/freeze.ts +14 -0
- package/lib/utils/index.ts +3 -0
- package/lib/utils/map-context-diff.test.ts +577 -0
- package/lib/utils/map-context-diff.ts +144 -0
- package/lib/utils/url.test.ts +14 -0
- package/lib/utils/url.ts +20 -0
- package/package.json +26 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { removeSearchParams } from "./url";
|
|
2
|
+
|
|
3
|
+
describe("URL utils", () => {
|
|
4
|
+
describe("removeSearchParams", () => {
|
|
5
|
+
it("removes given search params in a case insensitive way", () => {
|
|
6
|
+
expect(
|
|
7
|
+
removeSearchParams(
|
|
8
|
+
"http://my.org/abc/?arg0=1234&arg1=aaa&Arg1=111&ARG2=&aRG3=fff&arg4=5678",
|
|
9
|
+
["ARG1", "arg2", "arg3"],
|
|
10
|
+
),
|
|
11
|
+
).toEqual("http://my.org/abc/?arg0=1234&arg4=5678");
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
});
|
package/lib/utils/url.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes the given search params from the URL completely; this is case-insensitive
|
|
3
|
+
* @param url
|
|
4
|
+
* @param searchParams
|
|
5
|
+
*/
|
|
6
|
+
export function removeSearchParams(
|
|
7
|
+
url: string,
|
|
8
|
+
searchParams: string[],
|
|
9
|
+
): string {
|
|
10
|
+
const toDelete = [];
|
|
11
|
+
const urlObj = new URL(url, window.location.toString());
|
|
12
|
+
const keysLower = searchParams.map((p) => p.toLowerCase());
|
|
13
|
+
for (const param of urlObj.searchParams.keys()) {
|
|
14
|
+
if (keysLower.indexOf(param.toLowerCase()) > -1) {
|
|
15
|
+
toDelete.push(param);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
toDelete.map((param) => urlObj.searchParams.delete(param));
|
|
19
|
+
return urlObj.toString();
|
|
20
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@geospatial-sdk/core",
|
|
3
|
+
"version": "0.0.5-alpha.1",
|
|
4
|
+
"description": "Core functions and models for the SDK",
|
|
5
|
+
"author": "Olivia <olivia.guyot@camptocamp.com>",
|
|
6
|
+
"homepage": "",
|
|
7
|
+
"license": "BSD-3-Clause",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"typings": "dist/index.d.ts",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"directories": {
|
|
15
|
+
"lib": "lib"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"lib",
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "vitest",
|
|
23
|
+
"build": "tsc"
|
|
24
|
+
},
|
|
25
|
+
"gitHead": "811e99c3e403ac2502dd06252183dd7db79c2a61"
|
|
26
|
+
}
|