query-string 6.13.1 → 6.13.5

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.
Files changed (2) hide show
  1. package/index.d.ts +25 -4
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -121,7 +121,7 @@ export interface ParseOptions {
121
121
  ```
122
122
  */
123
123
  readonly parseBooleans?: boolean;
124
-
124
+
125
125
  /**
126
126
  Parse the fragment identifier from the URL and add it to result object.
127
127
 
@@ -139,7 +139,7 @@ export interface ParseOptions {
139
139
  }
140
140
 
141
141
  export interface ParsedQuery<T = string> {
142
- [key: string]: T | T[] | null | undefined;
142
+ [key: string]: T | T[] | null;
143
143
  }
144
144
 
145
145
  /**
@@ -339,11 +339,18 @@ export interface StringifyOptions {
339
339
  readonly skipEmptyString?: boolean;
340
340
  }
341
341
 
342
+ export type Stringifiable = string | boolean | number | null | undefined;
343
+
344
+ export type StringifiableRecord = Record<
345
+ string,
346
+ Stringifiable | Stringifiable[]
347
+ >;
348
+
342
349
  /**
343
350
  Stringify an object into a query string and sort the keys.
344
351
  */
345
352
  export function stringify(
346
- object: {[key: string]: any},
353
+ object: StringifiableRecord,
347
354
  options?: StringifyOptions
348
355
  ): string;
349
356
 
@@ -354,6 +361,20 @@ Note: This behaviour can be changed with the `skipNull` option.
354
361
  */
355
362
  export function extract(url: string): string;
356
363
 
364
+ export interface UrlObject {
365
+ readonly url: string;
366
+
367
+ /**
368
+ Overrides queries in the `url` property.
369
+ */
370
+ readonly query: StringifiableRecord;
371
+
372
+ /**
373
+ Overrides the fragment identifier in the `url` property.
374
+ */
375
+ readonly fragmentIdentifier?: string;
376
+ }
377
+
357
378
  /**
358
379
  Stringify an object into a URL with a query string and sorting the keys. The inverse of [`.parseUrl()`](https://github.com/sindresorhus/query-string#parseurlstring-options)
359
380
 
@@ -380,6 +401,6 @@ queryString.stringifyUrl({
380
401
  ```
381
402
  */
382
403
  export function stringifyUrl(
383
- object: ParsedUrl,
404
+ object: UrlObject,
384
405
  options?: StringifyOptions
385
406
  ): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "query-string",
3
- "version": "6.13.1",
3
+ "version": "6.13.5",
4
4
  "description": "Parse and stringify URL query strings",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/query-string",