hh-contracts 0.0.103 → 0.0.105

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.
@@ -41,11 +41,12 @@ const z = __importStar(require("zod"));
41
41
  // if (typeof value === 'boolean') return value;
42
42
  // return value === 'true' || value === '1' || value === 'yes';
43
43
  // });
44
- exports.BooleanQueryParamSchema = z
45
- .enum(['all', 'true', 'false', '1', '0', 'yes', 'no'])
46
- .transform(value => {
47
- if (value === 'all') {
48
- return undefined;
49
- }
50
- return value === 'true' || value === '1' || value === 'yes';
44
+ exports.BooleanQueryParamSchema = z.union([z.boolean(), z.string()]).transform(value => {
45
+ if (typeof value === 'boolean')
46
+ return value;
47
+ const v = value.trim().toLowerCase();
48
+ if (v === 'true' || v === '1' || v === 'yes')
49
+ return true;
50
+ if (v === 'false' || v === '0' || v === 'no')
51
+ return false;
51
52
  });
@@ -7,11 +7,9 @@ import * as z from 'zod';
7
7
  // return value === 'true' || value === '1' || value === 'yes';
8
8
  // });
9
9
 
10
- export const BooleanQueryParamSchema = z
11
- .enum(['all', 'true', 'false', '1', '0', 'yes', 'no'])
12
- .transform(value => {
13
- if (value === 'all') {
14
- return undefined;
15
- }
16
- return value === 'true' || value === '1' || value === 'yes';
17
- });
10
+ export const BooleanQueryParamSchema = z.union([z.boolean(), z.string()]).transform(value => {
11
+ if (typeof value === 'boolean') return value;
12
+ const v = value.trim().toLowerCase();
13
+ if (v === 'true' || v === '1' || v === 'yes') return true;
14
+ if (v === 'false' || v === '0' || v === 'no') return false;
15
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hh-contracts",
3
- "version": "0.0.103",
3
+ "version": "0.0.105",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {