typezen
Version:
A collection of TypeScript utilities for safe type checking and inference.
208 lines (200 loc) • 9.68 kB
TypeScript
declare const isNumber: (value: unknown) => value is number;
declare const isInteger: (value: unknown) => value is number;
declare const isFloat: (value: unknown) => boolean;
declare const isNaNValue: (value: unknown) => boolean;
declare const isBetween: (value: number, min: number, max: number) => boolean;
declare const isPositive: (value: number) => boolean;
declare const isNegative: (value: number) => boolean;
declare const isBoolean: (value: unknown) => value is boolean;
declare const isObject: <T extends object>(value: unknown) => value is T;
declare const isArray: <T>(value: unknown) => value is T[];
declare const isString: (value: unknown) => value is string;
declare const isArrayOfSting: (value: unknown) => value is string[];
declare const isPromise: <T>(value: unknown) => value is Promise<T>;
declare const isError: (value: unknown) => value is Error;
declare const isMap: <K, V>(value: unknown) => value is Map<K, V>;
declare const isSet: <T>(value: unknown) => value is Set<T>;
declare const isFunction: (value: unknown) => value is Function;
declare const isAsyncFunction: (value: unknown) => boolean;
declare const isPrimitive: (value: unknown) => boolean;
declare const isHexColor: (value: string) => boolean;
declare const isEmail: (value: string) => boolean;
declare const isUUID: (value: string) => boolean;
declare const isBase64URL: (value: string) => boolean;
declare const isBinary: (value: unknown) => boolean;
declare const isURL: (value: string) => boolean;
declare const isJWT: (value: string) => boolean;
declare const isCreditCard: (value: string) => boolean;
declare const isISBN: (value: string) => boolean;
declare const isMACAddress: (value: string) => boolean;
declare const isIPAddress: (value: string) => boolean;
declare const isDate: (value: string) => boolean;
declare const isDeepEqual: (a: any, b: any) => boolean;
declare const isWeakMap: (value: unknown) => boolean;
declare const isWeakSet: (value: unknown) => boolean;
declare const isIterable: (value: unknown) => boolean;
declare const isAsyncIterable: (value: unknown) => boolean;
declare const isTypedArray: (value: unknown) => boolean;
declare const isArrayBuffer: (value: unknown) => boolean;
declare const isDataView: (value: unknown) => boolean;
declare const isSharedArrayBuffer: (value: unknown) => boolean;
declare const isBuffer: (value: unknown) => boolean;
declare function isUndefined(value: unknown): value is undefined;
declare function isNull(value: unknown): value is null;
declare function isNullOrUndefined(value: unknown): value is null | undefined;
declare function isPlainObject(value: unknown): value is Record<string, unknown>;
declare const isEmpty: (value: unknown) => boolean;
declare function isEmptyArray(value: unknown): boolean;
declare function isEmptyString(value: unknown): boolean;
declare function isNegativeZero(value: unknown): boolean;
declare function isInfinity(value: unknown): boolean;
declare function isThenable(value: unknown): value is PromiseLike<unknown>;
declare function isDomain(value: string): boolean;
declare function isSemVer(value: string): boolean;
declare function isEmptyObject(value: unknown): boolean;
declare function isClass(value: unknown): boolean;
declare function isEventEmitter(value: unknown): value is NodeJS.EventEmitter;
declare function isMimeType(value: string): boolean;
declare function isHTTPS(value: string): boolean;
declare function isMapIterator(value: unknown): boolean;
declare function isSetIterator(value: unknown): boolean;
declare function isSafeInteger(value: unknown): value is number;
declare const isNodeJS: () => boolean;
declare const isBrowser: () => boolean;
declare const isMobile: () => boolean;
declare const isDesktop: () => boolean;
declare const isImageFile: (file: File) => boolean;
declare const isZipFile: (filePath: string) => boolean;
declare const isTarFile: (filePath: string) => boolean;
declare const isGzFile: (filePath: string) => boolean;
declare const isRarFile: (filePath: string) => boolean;
declare const is7zFile: (filePath: string) => boolean;
declare const isTgzFile: (filePath: string) => boolean;
declare const isBz2File: (filePath: string) => boolean;
declare const isXzFile: (filePath: string) => boolean;
declare const isExecutableFile: (filePath: string) => boolean;
declare const isPlainTextFile: (filePath: string) => boolean;
declare const isMarkdownFile: (filePath: string) => boolean;
declare const isHTMLFile: (filePath: string) => boolean;
declare const isCSSFile: (filePath: string) => boolean;
declare const isJavaScriptFile: (filePath: string) => boolean;
declare const isTypeScriptFile: (filePath: string) => boolean;
declare const isSVG: (filePath: string) => boolean;
declare const isPNG: (filePath: string) => boolean;
declare const isJPG: (filePath: string) => boolean;
declare const isJPEG: (filePath: string) => boolean;
declare const isGIF: (filePath: string) => boolean;
declare const isWEBP: (filePath: string) => boolean;
declare const isICO: (filePath: string) => boolean;
declare const isBMP: (filePath: string) => boolean;
declare const isTIFF: (filePath: string) => boolean;
declare const isPDF: (filePath: string) => boolean;
declare const isDOC: (filePath: string) => boolean;
declare const isDOCX: (filePath: string) => boolean;
declare const isXLS: (filePath: string) => boolean;
declare const isXLSX: (filePath: string) => boolean;
declare const isPPT: (filePath: string) => boolean;
declare const isPPTX: (filePath: string) => boolean;
declare const isTXT: (filePath: string) => boolean;
declare const isCSV: (filePath: string) => boolean;
declare const isJSON: (filePath: string) => boolean;
declare const isYAML: (filePath: string) => boolean;
declare const isXML: (filePath: string) => boolean;
declare const isMp3: (filePath: string) => boolean;
declare const isMp4: (filePath: string) => boolean;
declare const isEven: (value: number) => boolean;
declare const isOdd: (value: number) => boolean;
declare const isPrime: (value: number) => boolean;
declare const isPerfect: (value: number) => boolean;
declare const isPalindrome: (value: number) => boolean;
declare const isArmstrong: (value: number) => boolean;
declare const isPerfectSquare: (value: number) => boolean;
declare const isFibonacci: (value: number) => boolean;
declare const isFactorial: (value: number) => boolean;
declare const isLeapYear: (value: number) => boolean;
declare const isWeekend: (value: Date) => boolean;
declare const isWeekday: (value: Date) => boolean;
declare const isFutureDate: (value: Date) => boolean;
declare const isPastDate: (value: Date) => boolean;
declare const isToday: (value: Date) => boolean;
declare const isYesterday: (value: Date) => boolean;
declare const isTomorrow: (value: Date) => boolean;
declare const isValidRegExp: (regex: unknown) => boolean;
declare enum ImageFileExtension {
JPG = "jpg",
JPEG = "jpeg",
PNG = "png",
GIF = "gif",
BMP = "bmp",
TIFF = "tiff",
TIF = "tif",
WEBP = "webp",
SVG = "svg",
ICO = "ico",
HEIC = "heic",
HEIF = "heif",
AVIF = "avif",
APNG = "apng",
JXR = "jxr",
HDP = "hdp",
WDP = "wdp",
PSD = "psd",
PSB = "psb",
AI = "ai",
EPS = "eps",
CPT = "cpt",
SGI = "sgi",
RGB = "rgb",
RGBA = "rgba",
BW = "bw",
PBM = "pbm",
PGM = "pgm",
PPM = "ppm",
PNM = "pnm",
PXM = "pxm",
DPX = "dpx",
CIN = "cin",
VDA = "vda",
X3F = "x3f",
ERF = "erf",
THREE_FR = "3fr",
IIQ = "iiq",
FFF = "fff",
MOS = "mos",
MEF = "mef",
J2K = "j2k",
JP2 = "jp2",
JPF = "jpf",
JPX = "jpx",
JPM = "jpm",
MJ2 = "mj2",
ICNS = "icns",
DDS = "dds",
TGA = "tga",
ICB = "icb",
VST = "vst",
IMG = "img",
CE1 = "ce1",
PCX = "pcx",
RLE = "rle",
DCR = "dcr",
DC2 = "dc2",
PCD = "pcd",
XPM = "xpm",
XWD = "xwd",
CUR = "cur",
ANI = "ani",
WMF = "wmf",
EMF = "emf",
AFPHOTO = "afphoto",
AFDESIGN = "afdesign",
SAI = "sai",
ORA = "ora",
SPR = "spr",
KDC = "kdc"
}
declare class TypeValidationError extends Error {
constructor(message: string);
}
type ImageFileExtensionType = keyof typeof ImageFileExtension;
export { type ImageFileExtensionType, TypeValidationError, is7zFile, isArmstrong, isArray, isArrayBuffer, isArrayOfSting, isAsyncFunction, isAsyncIterable, isBMP, isBase64URL, isBetween, isBinary, isBoolean, isBrowser, isBuffer, isBz2File, isCSSFile, isCSV, isClass, isCreditCard, isDOC, isDOCX, isDataView, isDate, isDeepEqual, isDesktop, isDomain, isEmail, isEmpty, isEmptyArray, isEmptyObject, isEmptyString, isError, isEven, isEventEmitter, isExecutableFile, isFactorial, isFibonacci, isFloat, isFunction, isFutureDate, isGIF, isGzFile, isHTMLFile, isHTTPS, isHexColor, isICO, isIPAddress, isISBN, isImageFile, isInfinity, isInteger, isIterable, isJPEG, isJPG, isJSON, isJWT, isJavaScriptFile, isLeapYear, isMACAddress, isMap, isMapIterator, isMarkdownFile, isMimeType, isMobile, isMp3, isMp4, isNaNValue, isNegative, isNegativeZero, isNodeJS, isNull, isNullOrUndefined, isNumber, isObject, isOdd, isPDF, isPNG, isPPT, isPPTX, isPalindrome, isPastDate, isPerfect, isPerfectSquare, isPlainObject, isPlainTextFile, isPositive, isPrime, isPrimitive, isPromise, isRarFile, isSVG, isSafeInteger, isSemVer, isSet, isSetIterator, isSharedArrayBuffer, isString, isTIFF, isTXT, isTarFile, isTgzFile, isThenable, isToday, isTomorrow, isTypeScriptFile, isTypedArray, isURL, isUUID, isUndefined, isValidRegExp, isWEBP, isWeakMap, isWeakSet, isWeekday, isWeekend, isXLS, isXLSX, isXML, isXzFile, isYAML, isYesterday, isZipFile };