You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: base.d.ts
+21-6Lines changed: 21 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -182,14 +182,14 @@ export type ParseOptions = {
182
182
183
183
Use this option to explicitly define the type of a specific parameter—particularly useful in cases where the type might otherwise be ambiguous (e.g., phone numbers or IDs).
184
184
185
-
You can also provide a custom function to transform the value. The function will receive the raw string and should return the desired parsed result (see Example 4).
185
+
You can also provide a custom function to transform the value. The function will receive the raw string and should return the desired parsed result. When used with array formats (like `comma`, `separator`, `bracket`, etc.), the function is applied to each array element individually.
186
186
187
187
NOTE: Array types (`string[]`, `number[]`) are ignored if `arrayFormat` is set to `'none'`.
188
188
189
189
@default {}
190
190
191
191
@example
192
-
Parse `phoneNumber` as a string, overriding the `parseNumber` option:
192
+
Parse `phoneNumber` as a string, overriding the `parseNumbers` option:
193
193
```
194
194
import queryString from 'query-string';
195
195
@@ -203,12 +203,12 @@ export type ParseOptions = {
203
203
```
204
204
205
205
@example
206
-
Parse `items` as an array of strings, overriding the `parseNumber` option:
206
+
Parse `items` as an array of strings, overriding the `parseNumbers` option:
207
207
```
208
208
import queryString from 'query-string';
209
209
210
210
queryString.parse('?age=20&items=1%2C2%2C3', {
211
-
parseNumber: true,
211
+
parseNumbers: true,
212
212
types: {
213
213
items: 'string[]',
214
214
}
@@ -236,12 +236,27 @@ export type ParseOptions = {
Copy file name to clipboardExpand all lines: readme.md
+13-6Lines changed: 13 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -201,13 +201,11 @@ Parse the value as a boolean type instead of string type if it's a boolean.
201
201
Type: `object`\
202
202
Default: `{}`
203
203
204
-
205
204
Specifies a schema for parsing query values with explicit type declarations. When defined, the types provided here take precedence over general parsing options such as `parseNumbers`, `parseBooleans`, and `arrayFormat`.
206
205
207
206
Use this option to explicitly define the type of a specific parameter—particularly useful in cases where the type might otherwise be ambiguous (e.g., phone numbers or IDs).
208
207
209
-
You can also provide a custom function to transform the value. The function will receive the raw string and should return the desired parsed result.
210
-
208
+
You can also provide a custom function to transform the value. The function will receive the raw string and should return the desired parsed result. When used with array formats (like `comma`, `separator`, `bracket`, etc.), the function is applied to each array element individually.
-`'Function'`: Provide a custom function as the parameter type. The parameter's value will equal the function's return value.
282
+
-`'Function'`: Provide a custom function as the parameter type. The parameter's value will equal the function's return value. When used with array formats (like `comma`, `separator`, `bracket`, etc.), the function is applied to each array element individually.
0 commit comments