UNPKG

1.48 kBTypeScriptView Raw
1/**
2 * Options for function coerceDatetime
3 */
4export type DateCoercionOptions = {
5 dateOnly?: boolean;
6};
7/**
8 * Options for function coerceInteger
9 */
10export type IntegerCoercionOptions = {
11 isLong?: boolean;
12};
13export declare function isEmpty(data: string): boolean;
14/**
15 * A set of truthy values. A data in this set will be coerced to `true`.
16 *
17 * @param data - The raw data get from http request
18 * @returns The corresponding coerced boolean type
19 */
20export declare function isTrue(data: string): boolean;
21/**
22 * A set of falsy values. A data in this set will be coerced to `false`.
23 * @param data - The raw data get from http request
24 * @returns The corresponding coerced boolean type
25 */
26export declare function isFalse(data: string): boolean;
27/**
28 * Return false for invalid date
29 */
30export declare function isValidDateTime(data: Date): boolean;
31/**
32 * Return true when a date follows the RFC3339 standard
33 *
34 * @param date - The date to verify
35 */
36export declare function matchDateFormat(date: string): boolean;
37/**
38 * Return the corresponding OpenAPI data type given an OpenAPI schema
39 *
40 * @param type - The type in an OpenAPI schema specification
41 * @param format - The format in an OpenAPI schema specification
42 */
43export declare function getOAIPrimitiveType(type?: string, format?: string): "object" | "binary" | "boolean" | "string" | "number" | "integer" | "array" | "float" | "double" | "byte" | "date" | "date-time" | "password" | "long" | undefined;