Skip to content

Commit

Permalink
Ref: flip logic to inclusive.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTail committed Apr 1, 2024
1 parent 4989ce7 commit b8aad2f
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/documentation-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,25 +259,20 @@ export const depictNullable: Depicter<z.ZodNullable<z.ZodTypeAny>> = ({
return nested;
};

/**
* @todo use similar bigint handling when the following fix released:
* @link https://github.com/ramda/types/pull/116/files
* */
const getSupportedType = (value: unknown): SchemaObjectType | undefined => {
const detected = toLower(detectType(value)); // toLower is typed well unlike .toLowerCase()
const isUnsupported =
detected === "symbol" ||
detected === "undefined" ||
detected === "function" ||
detected === "date" ||
detected === "regexp" ||
detected === "asyncfunction" ||
detected === "error";
const isSupported =
detected === "number" ||
detected === "string" ||
detected === "boolean" ||
detected === "object" ||
detected === "null" ||
detected === "array";
return typeof value === "bigint"
? "integer"
: isUnsupported
? undefined
: detected;
: isSupported
? detected
: undefined;
};

export const depictEnum: Depicter<
Expand Down

0 comments on commit b8aad2f

Please sign in to comment.