zustand-querystring 0.6.0 → 0.6.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/README.md +6 -4
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -131,7 +131,7 @@ Three built-in formats:
|
|
|
131
131
|
| Format | Example Output |
|
|
132
132
|
|--------|----------------|
|
|
133
133
|
| `marked` | `count:5,tags@a,b~` |
|
|
134
|
-
| `plain` | `count=5&tags=a
|
|
134
|
+
| `plain` | `count=5&tags=a&tags=b` |
|
|
135
135
|
| `json` | `count=5&tags=%5B%22a%22%5D` |
|
|
136
136
|
|
|
137
137
|
```ts
|
|
@@ -165,7 +165,7 @@ const format = createFormat({
|
|
|
165
165
|
|
|
166
166
|
### Plain Format
|
|
167
167
|
|
|
168
|
-
Dot notation for nesting,
|
|
168
|
+
Dot notation for nesting, repeated keys for arrays.
|
|
169
169
|
|
|
170
170
|
```ts
|
|
171
171
|
import { createFormat } from 'zustand-querystring/format/plain';
|
|
@@ -173,7 +173,7 @@ import { createFormat } from 'zustand-querystring/format/plain';
|
|
|
173
173
|
const format = createFormat({
|
|
174
174
|
entrySeparator: ',', // between entries in namespaced mode
|
|
175
175
|
nestingSeparator: '.', // for nested keys
|
|
176
|
-
arraySeparator: '
|
|
176
|
+
arraySeparator: 'repeat', // 'repeat' for ?tags=a&tags=b, or ',' for ?tags=a,b
|
|
177
177
|
escapeChar: '_',
|
|
178
178
|
nullString: 'null',
|
|
179
179
|
undefinedString: 'undefined',
|
|
@@ -183,6 +183,8 @@ const format = createFormat({
|
|
|
183
183
|
});
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
+
> **Note on `arraySeparator: ','`**: With comma-separated arrays and dynamic keys (e.g., `initialState: { filters: {} }`), a single array value like `os=CentOS` is indistinguishable from a scalar string. Use `'repeat'` for dynamic keys, or normalize with `Array.isArray(val) ? val : [val]`.
|
|
187
|
+
|
|
186
188
|
### JSON Format
|
|
187
189
|
|
|
188
190
|
URL-encoded JSON. No configuration.
|
|
@@ -301,4 +303,4 @@ import type {
|
|
|
301
303
|
|
|
302
304
|
---
|
|
303
305
|
|
|
304
|
-
[Playground](https://
|
|
306
|
+
[Playground](https://zustand-querystring.nitedani.workers.dev) · [GitHub](https://github.com/nitedani/zustand-querystring)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zustand-querystring",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -76,6 +76,9 @@
|
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"lodash-es": "^4.17.21"
|
|
78
78
|
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"zustand": ">=5.0.0"
|
|
81
|
+
},
|
|
79
82
|
"prettier": {
|
|
80
83
|
"singleQuote": true,
|
|
81
84
|
"arrowParens": "avoid"
|