@cabloy/zod-query 2.1.15 → 2.1.16

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/dist/index.js +17 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -138,6 +138,8 @@ function __parseAdapter(inst, parse) {
138
138
  return __parseString(inst, parse, payload, _);
139
139
  case 'number':
140
140
  return __parseNumber(inst, parse, payload, _);
141
+ case 'literal':
142
+ return __parseLiteral(inst, parse, payload, _);
141
143
  case 'bigint':
142
144
  return __parseBigInt(inst, parse, payload, _);
143
145
  case 'boolean':
@@ -196,6 +198,21 @@ function __parseNumber(_inst, parse, payload, _) {
196
198
  return parse(payload, _);
197
199
  }
198
200
 
201
+ /////////////////////////////////////////
202
+ /////////////////////////////////////////
203
+ /// /////// /////////
204
+ /// /////// ZodLiteral /////////
205
+ /// /////// /////////
206
+ /////////////////////////////////////////
207
+ /////////////////////////////////////////
208
+
209
+ function __parseLiteral(inst, parse, payload, _) {
210
+ if (typeof payload.value === 'string' && !inst.values.has(payload.value) && [...inst.values].some(value => typeof value === 'number')) {
211
+ return __parseNumber(inst, parse, payload, _);
212
+ }
213
+ return parse(payload, _);
214
+ }
215
+
199
216
  /////////////////////////////////////////
200
217
  /////////////////////////////////////////
201
218
  /// /////// /////////
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cabloy/zod-query",
3
- "version": "2.1.15",
4
- "gitHead": "d4ca173cd034aee6e73d037f86745c9919218f80",
3
+ "version": "2.1.16",
4
+ "gitHead": "30aa129a2ca0c4ef6dde9cc910d42f7b3982ef79",
5
5
  "description": "zod-query",
6
6
  "keywords": [
7
7
  "ioc",