@douglasneuroinformatics/libjs 1.3.0 → 1.3.1
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.
- package/dist/zod.d.ts +2 -4
- package/dist/zod.d.ts.map +1 -1
- package/dist/zod.js +15 -20
- package/package.json +1 -1
package/dist/zod.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
type SchemaFactory<TSchema extends z.ZodTypeAny, TInput = any> = (extend?: (base: TSchema) => TSchema) => z.ZodEffects<TSchema, z.TypeOf<TSchema>, TInput>;
|
|
3
2
|
/** Used to determine if object is of type `ZodType` independent of specific instances or library versions */
|
|
4
3
|
export declare function isZodType(arg: unknown): arg is z.ZodTypeAny;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export {};
|
|
4
|
+
export declare const $BooleanLike: z.ZodEffects<z.ZodBoolean, boolean, unknown>;
|
|
5
|
+
export declare const $NumberLike: z.ZodEffects<z.ZodNumber, number, unknown>;
|
|
8
6
|
//# sourceMappingURL=zod.d.ts.map
|
package/dist/zod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../src/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../src/zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,6GAA6G;AAC7G,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,CAAC,CAAC,UAAU,CAM3D;AAED,eAAO,MAAM,YAAY,8CASV,CAAC;AAEhB,eAAO,MAAM,WAAW,4CAKV,CAAC"}
|
package/dist/zod.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { isNumberLike, parseNumber } from './number.js';
|
|
3
3
|
import { isObject } from './object.js';
|
|
4
|
-
const defaultExtend = (schema) => schema;
|
|
5
4
|
/** Used to determine if object is of type `ZodType` independent of specific instances or library versions */
|
|
6
5
|
export function isZodType(arg) {
|
|
7
6
|
let prototype = null;
|
|
@@ -10,24 +9,20 @@ export function isZodType(arg) {
|
|
|
10
9
|
}
|
|
11
10
|
return Boolean(prototype && Reflect.get(prototype, 'name') === 'ZodType');
|
|
12
11
|
}
|
|
13
|
-
export const
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
else if (arg.trim().toLowerCase() === 'false') {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
12
|
+
export const $BooleanLike = z.preprocess((arg) => {
|
|
13
|
+
if (typeof arg === 'string') {
|
|
14
|
+
if (arg.trim().toLowerCase() === 'true') {
|
|
15
|
+
return true;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
export const $$NumberLike = (extend = defaultExtend) => {
|
|
27
|
-
return z.preprocess((arg) => {
|
|
28
|
-
if (isNumberLike(arg)) {
|
|
29
|
-
return parseNumber(arg);
|
|
17
|
+
else if (arg.trim().toLowerCase() === 'false') {
|
|
18
|
+
return false;
|
|
30
19
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
20
|
+
}
|
|
21
|
+
return arg;
|
|
22
|
+
}, z.boolean());
|
|
23
|
+
export const $NumberLike = z.preprocess((arg) => {
|
|
24
|
+
if (isNumberLike(arg)) {
|
|
25
|
+
return parseNumber(arg);
|
|
26
|
+
}
|
|
27
|
+
return arg;
|
|
28
|
+
}, z.number());
|
package/package.json
CHANGED