@igorkosta/urlparams 1.0.0 → 1.0.2
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/README.md +1 -0
- package/package.json +6 -2
- package/.README.md.un~ +0 -0
- package/.index.js.un~ +0 -0
- package/.package.json.un~ +0 -0
- package/.test.js.un~ +0 -0
- package/test.js +0 -46
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igorkosta/urlparams",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "URL Params as JSON Object",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"url",
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "index.js",
|
|
15
15
|
"scripts": {
|
|
16
|
-
"test": "node test.js"
|
|
16
|
+
"test": "node tests/test.js"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/igorkosta/urlparams.git"
|
|
17
21
|
}
|
|
18
22
|
}
|
package/.README.md.un~
DELETED
|
Binary file
|
package/.index.js.un~
DELETED
|
Binary file
|
package/.package.json.un~
DELETED
|
Binary file
|
package/.test.js.un~
DELETED
|
Binary file
|
package/test.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// test/index.test.js
|
|
2
|
-
import test from "node:test";
|
|
3
|
-
import assert from "node:assert/strict";
|
|
4
|
-
|
|
5
|
-
import searchParams from "./index.js";
|
|
6
|
-
|
|
7
|
-
test("Get URL Params as JSON Object", () => {
|
|
8
|
-
const url = "https://example.com?foo=bar&baz=qux";
|
|
9
|
-
const result = searchParams(url);
|
|
10
|
-
assert.equal(typeof result, "object");
|
|
11
|
-
assert.deepStrictEqual({
|
|
12
|
-
foo: "bar",
|
|
13
|
-
baz: "qux"
|
|
14
|
-
}, result);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test("With encoded values", () => {
|
|
18
|
-
const url = "https://example.com/?q=hello%20world&lang=en";
|
|
19
|
-
const result = searchParams(url);
|
|
20
|
-
console.log(result);
|
|
21
|
-
assert.equal(typeof result, "object");
|
|
22
|
-
assert.deepStrictEqual({
|
|
23
|
-
q: "hello world",
|
|
24
|
-
lang: "en"
|
|
25
|
-
}, result);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
test("Wit Repeated Parameters", () => {
|
|
30
|
-
const url = "https://example.com/?tag=js&tag=node&tag=web";
|
|
31
|
-
const result = searchParams(url);
|
|
32
|
-
console.log(result);
|
|
33
|
-
assert.equal(typeof result, "object");
|
|
34
|
-
assert.deepStrictEqual({
|
|
35
|
-
tag: ["js", "node", "web"]
|
|
36
|
-
}, result);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test("Without Parameters", () => {
|
|
40
|
-
const url = "https://example.com/";
|
|
41
|
-
const result = searchParams(url);
|
|
42
|
-
console.log(result);
|
|
43
|
-
assert.equal(typeof result, "object");
|
|
44
|
-
assert.deepStrictEqual({
|
|
45
|
-
}, result);
|
|
46
|
-
});
|