@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 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 $$BooleanLike: SchemaFactory<z.ZodBoolean>;
6
- export declare const $$NumberLike: SchemaFactory<z.ZodNumber>;
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;AAOxB,KAAK,aAAa,CAAC,OAAO,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,IAAI,CAC/D,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,KAChC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;AAEtD,6GAA6G;AAC7G,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,CAAC,CAAC,UAAU,CAM3D;AAED,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,UAAU,CAWrD,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAOnD,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 $$BooleanLike = (extend = defaultExtend) => {
14
- return z.preprocess((arg) => {
15
- if (typeof arg === 'string') {
16
- if (arg.trim().toLowerCase() === 'true') {
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
- return arg;
24
- }, extend(z.boolean()));
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
- return arg;
32
- }, extend(z.number()));
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@douglasneuroinformatics/libjs",
3
3
  "type": "module",
4
- "version": "1.3.0",
4
+ "version": "1.3.1",
5
5
  "packageManager": "pnpm@10.3.0",
6
6
  "description": "A collection of utility functions and types for Node.js and the browser",
7
7
  "author": "Joshua Unrau",