mashroo3 0.3.0 → 0.4.0
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/index.d.ts +2 -1
- package/index.js +3 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export type QueryValue =
|
|
|
4
4
|
| boolean
|
|
5
5
|
| null
|
|
6
6
|
| undefined
|
|
7
|
-
|
|
|
7
|
+
| Record<string, unknown>
|
|
8
|
+
| Array<string | number | boolean | null | undefined | Record<string, unknown>>;
|
|
8
9
|
|
|
9
10
|
export type QueryParams = Record<string, QueryValue>;
|
|
10
11
|
|
package/index.js
CHANGED
|
@@ -150,8 +150,10 @@ class Mashroo3 {
|
|
|
150
150
|
if (Array.isArray(value)) {
|
|
151
151
|
for (const item of value) {
|
|
152
152
|
if (item === undefined || item === null) continue;
|
|
153
|
-
url.searchParams.append(key, String(item));
|
|
153
|
+
url.searchParams.append(key, typeof item === "object" ? JSON.stringify(item) : String(item));
|
|
154
154
|
}
|
|
155
|
+
} else if (typeof value === "object") {
|
|
156
|
+
url.searchParams.set(key, JSON.stringify(value));
|
|
155
157
|
} else {
|
|
156
158
|
url.searchParams.set(key, String(value));
|
|
157
159
|
}
|