zustand-querystring 0.0.18 → 0.0.19

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  parse,
3
3
  stringify
4
- } from "./chunk-77OZJNG4.mjs";
4
+ } from "./chunk-ZM24AXRE.mjs";
5
5
 
6
6
  // src/utils.ts
7
7
  var escapeStringRegexp = (string) => {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  parse,
3
3
  stringify
4
- } from "./chunk-77OZJNG4.mjs";
4
+ } from "./chunk-ZM24AXRE.mjs";
5
5
 
6
6
  // src/middleware.ts
7
7
  import { mergeWith, isEqual, cloneDeep } from "lodash-es";
@@ -26,6 +26,9 @@ function stringify(input, recursive) {
26
26
  }
27
27
  return "@" + res.join("&") + ";";
28
28
  }
29
+ if (input instanceof Date) {
30
+ return "=!Date:" + encodeString(input.toISOString(), valueStringifyRegexp);
31
+ }
29
32
  if (typeof input === "object") {
30
33
  for (const [key, value] of Object.entries(input)) {
31
34
  const stringifiedValue = stringify(value, true);
@@ -65,7 +68,11 @@ function parse(str) {
65
68
  function parseToken() {
66
69
  const type = str.charAt(pos++);
67
70
  if (type === "=") {
68
- return readToken(valueParseRegexp);
71
+ const value = readToken(valueParseRegexp);
72
+ if (value.startsWith("!Date:")) {
73
+ return new Date(value.slice("!Date:".length));
74
+ }
75
+ return value;
69
76
  }
70
77
  if (type === ":") {
71
78
  const value = readToken(valueParseRegexp);
package/dist/index.js CHANGED
@@ -54,6 +54,9 @@ function stringify(input, recursive) {
54
54
  }
55
55
  return "@" + res.join("&") + ";";
56
56
  }
57
+ if (input instanceof Date) {
58
+ return "=!Date:" + encodeString(input.toISOString(), valueStringifyRegexp);
59
+ }
57
60
  if (typeof input === "object") {
58
61
  for (const [key, value] of Object.entries(input)) {
59
62
  const stringifiedValue = stringify(value, true);
@@ -93,7 +96,11 @@ function parse(str) {
93
96
  function parseToken() {
94
97
  const type = str.charAt(pos++);
95
98
  if (type === "=") {
96
- return readToken(valueParseRegexp);
99
+ const value = readToken(valueParseRegexp);
100
+ if (value.startsWith("!Date:")) {
101
+ return new Date(value.slice("!Date:".length));
102
+ }
103
+ return value;
97
104
  }
98
105
  if (type === ":") {
99
106
  const value = readToken(valueParseRegexp);
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  querystring
3
- } from "./chunk-H7YBN6IK.mjs";
3
+ } from "./chunk-S5N6DUVJ.mjs";
4
4
  import {
5
5
  createURL
6
- } from "./chunk-STY4LBQG.mjs";
6
+ } from "./chunk-PYA77ZUK.mjs";
7
7
  import {
8
8
  parse,
9
9
  stringify
10
- } from "./chunk-77OZJNG4.mjs";
10
+ } from "./chunk-ZM24AXRE.mjs";
11
11
  export {
12
12
  createURL,
13
13
  parse,
@@ -51,6 +51,9 @@ function stringify(input, recursive) {
51
51
  }
52
52
  return "@" + res.join("&") + ";";
53
53
  }
54
+ if (input instanceof Date) {
55
+ return "=!Date:" + encodeString(input.toISOString(), valueStringifyRegexp);
56
+ }
54
57
  if (typeof input === "object") {
55
58
  for (const [key, value] of Object.entries(input)) {
56
59
  const stringifiedValue = stringify(value, true);
@@ -90,7 +93,11 @@ function parse(str) {
90
93
  function parseToken() {
91
94
  const type = str.charAt(pos++);
92
95
  if (type === "=") {
93
- return readToken(valueParseRegexp);
96
+ const value = readToken(valueParseRegexp);
97
+ if (value.startsWith("!Date:")) {
98
+ return new Date(value.slice("!Date:".length));
99
+ }
100
+ return value;
94
101
  }
95
102
  if (type === ":") {
96
103
  const value = readToken(valueParseRegexp);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  querystring
3
- } from "./chunk-H7YBN6IK.mjs";
4
- import "./chunk-77OZJNG4.mjs";
3
+ } from "./chunk-S5N6DUVJ.mjs";
4
+ import "./chunk-ZM24AXRE.mjs";
5
5
  export {
6
6
  querystring
7
7
  };
package/dist/parser.js CHANGED
@@ -50,6 +50,9 @@ function stringify(input, recursive) {
50
50
  }
51
51
  return "@" + res.join("&") + ";";
52
52
  }
53
+ if (input instanceof Date) {
54
+ return "=!Date:" + encodeString(input.toISOString(), valueStringifyRegexp);
55
+ }
53
56
  if (typeof input === "object") {
54
57
  for (const [key, value] of Object.entries(input)) {
55
58
  const stringifiedValue = stringify(value, true);
@@ -89,7 +92,11 @@ function parse(str) {
89
92
  function parseToken() {
90
93
  const type = str.charAt(pos++);
91
94
  if (type === "=") {
92
- return readToken(valueParseRegexp);
95
+ const value = readToken(valueParseRegexp);
96
+ if (value.startsWith("!Date:")) {
97
+ return new Date(value.slice("!Date:".length));
98
+ }
99
+ return value;
93
100
  }
94
101
  if (type === ":") {
95
102
  const value = readToken(valueParseRegexp);
package/dist/parser.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  parse,
3
3
  stringify
4
- } from "./chunk-77OZJNG4.mjs";
4
+ } from "./chunk-ZM24AXRE.mjs";
5
5
  export {
6
6
  parse,
7
7
  stringify
package/dist/utils.js CHANGED
@@ -51,6 +51,9 @@ function stringify(input, recursive) {
51
51
  }
52
52
  return "@" + res.join("&") + ";";
53
53
  }
54
+ if (input instanceof Date) {
55
+ return "=!Date:" + encodeString(input.toISOString(), valueStringifyRegexp);
56
+ }
54
57
  if (typeof input === "object") {
55
58
  for (const [key, value] of Object.entries(input)) {
56
59
  const stringifiedValue = stringify(value, true);
@@ -90,7 +93,11 @@ function parse(str) {
90
93
  function parseToken() {
91
94
  const type = str.charAt(pos++);
92
95
  if (type === "=") {
93
- return readToken(valueParseRegexp);
96
+ const value = readToken(valueParseRegexp);
97
+ if (value.startsWith("!Date:")) {
98
+ return new Date(value.slice("!Date:".length));
99
+ }
100
+ return value;
94
101
  }
95
102
  if (type === ":") {
96
103
  const value = readToken(valueParseRegexp);
package/dist/utils.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createURL
3
- } from "./chunk-STY4LBQG.mjs";
4
- import "./chunk-77OZJNG4.mjs";
3
+ } from "./chunk-PYA77ZUK.mjs";
4
+ import "./chunk-ZM24AXRE.mjs";
5
5
  export {
6
6
  createURL
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zustand-querystring",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",