@nerdware/ddb-single-table
Version:
A schema-based DynamoDB modeling tool, high-level API, and type-generator built to supercharge single-table designs!⚡
46 lines • 2.33 kB
TypeScript
/**
* `number` type guard function
*
* ### DynamoDB Numbers
*
* - Can be positive, negative, or zero.
* - Can have up to 38 digits of precision (JS only supports up to 16 digits of precision).
* - Has a positive range of 1E-130 to 9.9999999999999999999999999999999999999E+125
* - Has a negative range of -9.9999999999999999999999999999999999999E+125 to -1E-130
* - Leading and trailing zeroes are trimmed.
*/
export declare const isNumber: (value?: unknown) => value is number;
/**
* Type guard function for `type: "tuple"`
*
* > **Note:** This function does not check the types of values _within_ the provided tuple — that
* is accomplished by the `typeChecking` IO-Action which is applied recursively to nested values
* via `recursivelyApplyIOAction`.
*/
export declare const isTuple: (value?: unknown, nestedSchema?: unknown) => value is [...unknown[]];
/** Type guard function for `type: "enum"` */
export declare const isEnumMember: <EnumValues extends ReadonlyArray<string>>(value?: unknown, allowedValues?: unknown) => value is EnumValues[number];
/**
* Type guard/safety functions for each of the supported schema attribute `type` values.
*/
export declare const isType: Readonly<{
/** Type guard function for `type: "string"` */
readonly string: (value?: unknown) => value is string;
/** Type guard function for `type: "number"` */
readonly number: (value?: unknown) => value is number;
/** Type guard function for `type: "boolean"` */
readonly boolean: (value?: unknown) => value is boolean;
/** Type guard function for `type: "Buffer"` */
readonly Buffer: (value?: unknown) => value is Buffer;
/** Type guard function for `type: "Date"` */
readonly Date: (value?: unknown) => value is Date;
/** Type guard function for `type: "array"` */
readonly array: (value?: unknown) => value is unknown[] | readonly unknown[];
/** Type guard function for `type: "map"` */
readonly map: (value?: unknown) => value is Record<string, unknown>;
/** Type guard function for `type: "tuple"` */
readonly tuple: (value?: unknown, nestedSchema?: unknown) => value is [...unknown[]];
/** Type guard function for `type: "enum"` */
readonly enum: (value?: unknown, allowedValues?: unknown) => value is string;
}>;
//# sourceMappingURL=isType.d.ts.map