type Coords = { lat: number; lng: number; }; type DateLike = Date | string | number; type Datey = Date | string; /** * @example "2021-01-01T00:00:00.000Z" */ type ISODate = string; /** * @example "2021-01-01" */ type ISODay = string; /** * @example "2021-01" */ type ISOMonth = string; /** * @example "2021" */ type ISOYear = string; /** * @example "America/New_York" */ type Timezone = string; type DateRange = { startDate: T; endDate: T; }; type DateSeries = T[]; /** * Makes all keys required and removes undefined and null from the value types. * @example * type Example = { * a: string; * b: string | undefined; * c?: string; * d?: number | null; * }; * type Result = Defined; * { * a: string, * b: string, * c: string, * d: number * } */ type Defined = { [P in keyof T]-?: NonNullable; }; type Dimensions = { width: number; height: number; }; type VoidFn = () => void; declare const noop: VoidFn; type Key = string | number | symbol; type PlainKey = string | number; type ObjectKey = keyof T; type ObjectKeys = ObjectKey[]; type ObjectValue = T[keyof T]; type ObjectValues = ObjectValue[]; type ObjectEntry = { [K in keyof T]: [K, T[K]]; }[keyof T]; type ObjectEntries = ObjectEntry[]; /** * A plain object is an object that is not an array, does not have a length property, and is not a function. * Would have been nice to call it just Object, but that's already taken by the built-in type. */ type PlainObject = Record & { length?: never; }; type HashMap = Record; type NumberMap = Record; type StringMap = Record; type BoolMap = Record; type TrueMap = Record; type Matrix = T[][]; type Maybe = T | null | undefined; type MaybePromise = Maybe>; type MaybePromiseOrValue = MaybePromise | T; type MaybePromiseOrValueArray = MaybePromiseOrValue[]; type NonUndefined = T extends undefined ? never : T; /** * Makes picked keys required and defined. * @example * type Example = { * a: string; * b: string | undefined; * c?: string; * d?: number | null; * }; * type Result = PickDefined; * { * a: string; * b: string | undefined; * d: number | null; * } */ type PickDefined = Pick, K>; /** * Makes picked keys required. (does not remove undefined and null from the value types) * @example * type Example = { * a: string; * b: string | undefined; * c?: string; * d?: number | null; * }; * type Result = PickRequired; * { * a: string; * b: string | undefined; * d: number | null; * } */ type PickRequired = Pick, K>; type Point = { x: number; y: number; }; type PrismaSelect = Record; type Serialized = T extends Date ? string : T extends Array ? Array> : T extends object ? { [K in keyof T]: Serialized; } : T; /** * * @description Generate a series of dates between the start and end dates * NOTE: it does NOT include the end date, this is intentional */ declare const getDateRangeSeries: (dateRange: DateRange, unit: "second" | "minute" | "hour" | "day" | "week" | "calendarMonth" | "calendarYear", options?: { step?: number; }) => ISODate[]; /** * @description Returns the smallest and biggest dates from an array of dates in DateRange format * @param dates - Array of dates to find the range for * @returns DateRange object with startDate (smallest) and endDate (biggest) * @throws Error if the array is empty or contains invalid dates */ declare const getDateSeriesRange: (dateSeries: DateSeries) => DateRange; type PropertyAccessor = keyof T | ((item: T) => any); /** * Groups items into date buckets based on their dates and specified time intervals * @param dateBuckets Array of ISO date strings that define the bucket boundaries, must be sorted in ascending order * @param items Array of items to be grouped into buckets, should be sorted in ascending order by the date property for optimal performance * @param unit The time unit to use for bucket intervals ('day', 'hour', 'minute', 'second') * @param accessor Optional property accessor for extracting dates from items. If not provided, assumes items are ISO date strings * @returns Record where keys are ISO date strings from dateBuckets and values are arrays of items that fall within each bucket's time range */ declare function groupByDateBucket({ dateBuckets, items, unit, accessor, }: { dateBuckets: ISODate[]; items: T[]; unit: "day" | "hour" | "minute" | "second"; accessor?: PropertyAccessor; }): Record; declare const isOver18: (birthDate: DateLike) => boolean; /** * Note: This function does not use defaults, use startOfToday instead. * * @param day - The date to get the start of the day for. * @returns A new Date object set to the start of the day. */ declare const startOfDay: (day: Date) => Date; declare const startOfNextMonth: () => Date; declare const startOfNextWeek: () => Date; declare const startOfThisWeek: () => Date; declare const startOfToday: () => Date; declare const startOfTomorrow: () => Date; declare const startOfUTCDay: (date: Date) => Date; /** * Returns the start of tomorrow (00:00:00.000) in UTC time. */ declare const startOfUTCTomorrow: () => Date; declare const startOfYesterday: () => Date; /** * @example formatCamelCase("hello-world") => "helloWorld" * @example formatCamelCase("hello_world") => "helloWorld" * @example formatCamelCase("Hello World") => "helloWorld" */ declare const formatCamelCase: (str: string) => string; /** * * @example formatCookies({}) => "" * @example formatCookies({ session: "123", _ga: 123 }) => "session=123; _ga=123;" */ declare const formatCookies: (object: PlainObject) => string; /** * @example formatCount({items: [1, 2, 3]}) => "3 items" * @example formatCount({items: [1, 2, 3], things: 5}) => "3 items, 5 things" * @example formatCount({users: 10, posts: 20}) => "10 users, 20 posts" */ declare const formatCount: (counters: Record) => string; /** * @example formatDateRange(startDate, endDate) => "2026-02-09T00:00:00.000Z ⮕ 2026-02-10T00:00:00.000Z" */ declare const formatDateRange: (startDate: Datey, endDate: Datey) => string; /** * * @example formatIndexProgress(-1, 10) => [1/10] capped * @example formatIndexProgress(1, 10) => [2/10] * @example formatIndexProgress(11, 10) => [10/10] capped */ declare const formatIndexProgress: (index: number, total: number) => string; /** * First letters of the first one or two words, capitalized. * * @example formatInitials("Ciao Bello") => "CB" * @example formatInitials("hello There") => "HT" * @example formatInitials("JavaScript") => "J" * @example formatInitials("Three words here") => "TW" * @example formatInitials(undefined) => "" */ declare const formatInitials: (str?: string | null) => string; /** * * @example formatNumber(1000, { compact: true }) // "1K" * @example formatNumber(0.001, { compact: true }) // "1m" * @example formatNumber(0.000001, { compact: true }) // "1μ" * @example formatNumber(0.000000001, { compact: true, unit: "s" }) // "1ns" * @example formatNumber(1111, { maxDigits: 2 }) // "1,100" (2 significant digits) * @example formatNumber(111111.123123123) // "111,111.123" (default 3 decimal places) * @example formatNumber(0.12345, { percentage: true, maxDigits: 2 }) // "12.35%" */ declare const formatNumber: (value: number, { compact, maxDigits, percentage, unit, sign, }?: { compact?: boolean; maxDigits?: number; percentage?: boolean; unit?: string; sign?: boolean; }) => string; /** * @example formatPascalCase("hello-world") => "HelloWorld" * @example formatPascalCase("hello_world") => "HelloWorld" * @example formatPascalCase("hello world") => "HelloWorld" */ declare const formatPascalCase: (str: string) => string; /** * @example formatPercentageNumber(0.123456) => 12.3456 * @example formatPercentageNumber(0.123456, { digits: 2 }) => 12.35 */ declare const formatPercentageNumber: (value: number, { digits, sign, }?: { digits?: number; sign?: boolean; }) => string; /** * * @example formatPercentage(1) => "100%" * @example formatPercentage(0, { digits: 2 }) => "0.00%" */ declare const formatPercentage: (value: number, { digits, sign, }?: { digits?: number; sign?: boolean; }) => string; /** * Formats a progress indicator showing the current index, total, and completion percentage. * * When a `progressId` is provided, also estimates and appends the remaining time based on * the rate of progress since the first call with that ID. Tracking state is automatically * cleaned up once the final item is reached. * * @param index - Zero-based index of the current item being processed. * @param total - Total number of items. * @param options - Optional configuration. * @param options.progressId - Stable identifier used to track throughput across calls and * compute a remaining-time estimate. Omit to skip time estimation. * @returns A formatted string such as `"42/100 42.00%"` or `"42/100 42.00% (~3m 20s remaining)"`. * * @example * for (const [i, item] of items.entries()) { * console.log(formatProgress(i, items.length, { progressId: "my-job" })); * await process(item); * } */ declare const formatProgress: (index: number, total: number, { progressId, }?: { progressId?: string; }) => string; /** * Transliterate and format a string as a URL/identifier slug. * * @example formatSlug("Hello World") => "hello-world" * @example formatSlug("Crème brûlée") => "creme-brulee" * @example formatSlug("José García", { replacement: " ", strict: true }) => "jose garcia" */ declare const formatSlug: (str: string, { lower, map, replacement, remove, strict, trim, }?: { /** Convert result to lowercase. @default true */ lower?: boolean; /** Extra character replacements for this call. */ map?: Record; /** Character used to replace spaces. @default "-" */ replacement?: string; /** Extra characters to strip (applied per character after mapping). */ remove?: RegExp; /** Keep only ASCII letters, digits, and spaces before applying replacement. @default false */ strict?: boolean; /** Trim leading/trailing whitespace before replacing spaces. @default true */ trim?: boolean; }) => string; declare const stringToCSSUnicode: (text: string) => string; declare const stringToUnicode: (text: string) => string; declare const array: any>(length: number, mapFn?: U) => ReturnType[]; /** * Given 2 arrays, returns the (unique) elements that belong to each but not both at the same time. * @example * arrayDiff([1, 2, 3], [2, 3, 4]); // [1, 4] */ declare const arrayDiff: (arr1: any[], arr2: any[]) => any[]; /** * @description Given 2 arrays, returns the (unique) elements that belong to both arrays. * @example * arrayIntersection([1, 2, 3], [2, 3, 4]); // [2, 3] */ declare const arrayIntersection: (arr1: T[], arr2: T[]) => T[]; declare const capitalize: (string: string) => string; declare const chunkArray: (array: T[], size: number) => T[][]; declare const chunkedAll: (array: T[], chunkSize: number, fn: (chunk: T[]) => Promise) => Promise; /** * @deprecated Use pMap/pAll/pReduce instead */ declare const chunkedAsync: (array: T[], chunkSize: number, fn: (chunk: T[], chunkIndex: number, chunks: T[][]) => Promise, { minChunkTimeMs, }?: { minChunkTimeMs?: number; }) => Promise; /** * @deprecated Use pMap/pAll/pReduce instead */ declare const chunkedDynamic: (array: T[], initialChunkSize: number, fn: (chunk: T[], currentChunkIndex: number) => Promise, { idealChunkDuration, maxChunkSize, minChunkDuration, minChunkSize, sleepTimeMs, }?: { idealChunkDuration?: number; maxChunkSize?: number; minChunkDuration?: number; minChunkSize?: number; sleepTimeMs?: number; }) => Promise; type ChunkTextOptions = { preserveOnBreak?: "sentence" | "word"; }; declare const chunkText: (text: string, chunkMaxSize: number, options?: ChunkTextOptions) => string[]; declare const clamp: ({ number, min, max, }: { number: number; min: number; max: number; }) => number; declare const cleanSpaces: (str: string) => string; /** * Copy a string to the system clipboard, works only in the browser * @param value - the string to copy * @returns a promise that resolves once the write is complete, or rejects if the Clipboard API is unavailable or the write fails */ declare const copyToClipboard: (value: string) => Promise; /** * @returns element from array at index, if index is greater than array length, it will loop back to the start of the array */ declare const cyclicalItem: (array: T[], index: number) => T; /** * Print or log helper that does not break on circular references, and expands nested objects. */ declare const dir: (arg: any, { maxDepth }?: { maxDepth?: number; }) => void; declare const enumKeys: (arg: T) => ObjectKeys; declare const enumValues: (enumObject: T) => ObjectValues; /** * Escapes special LIKE pattern metacharacters (`\`, `%`, `_`) so that a * user-supplied string is treated as a literal substring rather than a * pattern. Use together with an explicit `ESCAPE '\\'` clause in the query. * * @example * const pattern = `%${escapeSqlLikePattern(userInput)}%`; * db.query(`SELECT … WHERE col LIKE ? ESCAPE '\\'`, [pattern]); */ declare const escapeSqlLikePattern: (value: string) => string; declare const extractEmailDomain: (email: string) => string | undefined; /** * @returns a string with only alphanumeric characters * @example filterAlphanumeric("!abc()") // returns "abc" */ declare const filterAlphanumeric: (string: string) => string; declare const first: (arr: T[]) => T; declare const firstKey: (arg: T) => ObjectKey; declare const firstValue: (arg: T) => ObjectValue; type FileSizeUnit = "B" | "KB" | "MB" | "GB" | "TB" | "PB" | "EB"; /** * Formats a byte count into the requested unit, suffixed with the unit label * (e.g. `formatFileSize(2048)` => `"2 KB"`, `formatFileSize(5_242_880, "MB")` => `"5 MB"`). * * Rounds to the nearest whole unit and never returns less than 1, so small files * don't display as "0 KB". * * @param bytes - Size in bytes * @param unit - Unit to format to (defaults to "KB") */ declare const formatFileSize: (bytes: number, unit?: FileSizeUnit) => string; /** * Get a client cookie by name, works only in the browser * @param name * @returns the cookie value, if exists */ declare const getCookieByName: (name: string) => string | undefined; /** * Returns the English display name for an alpha-2 (e.g. "GB") country code. * Falls back to the original input when the code is unrecognised. */ declare const getCountryName: (countryCode: string) => string | undefined; /** * Returns the flag emoji for an ISO 3166-1 country code. * Accepts alpha-2 (e.g. "GB") codes. * Returns broken emoji when the code is unrecognised. */ declare const getFlagEmoji: (countryCode: string) => string; declare const getKeys: { (o: object): string[]; (o: {}): string[]; }; declare const getUrlSearchParam: (urlString: Maybe, param: string) => string | undefined; declare const getUrlSearchParams: (urlString: Maybe) => Record; /** * * @param items * @param key * @returns Record * @example * const items = [ * { externalId: 1, value: 100 }, * { externalId: 1, value: 50 }, * { externalId: 2, value: 200 }, * { externalId: 2, value: 100 }, * { mis_spelled_externalId: 2, value: 90 }, // not included in any group * ]; * const ordersByInstrument = groupByKey(items, "externalId"); * // { * // 1: [ * // { externalId: 1, value: 100 }, * // { externalId: 1, value: 50 }, * // ], * // 2: [ * // { externalId: 2, value: 200 }, * // { externalId: 2, value: 100 }, * // ], * // } */ declare const groupByKey: (items: T[], key: K) => Record; declare const incrementalId: () => number; declare const keysLength: (obj: T) => number; declare const last: (arr: T[]) => T; declare const lastIndex: (array: any[]) => number; /** * * @description Given an array of objects, returns a record where the key is the value of the object's key * NOTE: if two objects have the same key, the last one will be the one kept. * Useful for quick lookups by key. * @example * const items = [{ id: 1, name: "Alice" }, { id: 2, name: "Bob" }]; * const itemsById = mapByKey(items, "id"); * itemsById[1]; // { id: 1, name: "Alice" } * itemsById[2]; // { id: 2, name: "Bob" } */ declare const mapByKey: (items: T[], key: keyof T) => Record, // any value of T, excluding null and undefined T>; /** * @description Simple merge function that merges two objects, arrays get overwritten, no options * */ declare const merge: (target: PlainObject, source: PlainObject) => PlainObject; /** * @description Merge two arrays, unique values, no options * @example mergeArrays([1,2,3], [2,3,4]) => [1,2,3,4] */ declare const mergeArrays: (arrayA: any[], arrayB: any[]) => any[]; declare const moveToFirst: (items: T[], condition: (item: T, i: number, items: T[]) => boolean) => T[]; declare const moveToIndex: (items: T[], itemToMoveIndex: number, destinationIndex: number) => T[]; declare const moveToLast: (items: T[], condition: (item: T, i: number, items: T[]) => boolean) => T[]; declare const normalizeNumber: ({ value, max, min, }: { value: number; max: number; min: number; }) => number; declare const normalizeString: (str: string) => string; declare const omit: (obj: T, keys: (keyof T)[]) => Partial; declare const paginationToSkipTake: (pagination: { page: number; perPage: number; }) => { skip: number; take: number; }; type ParsedPrimitive = string | number | boolean | null | undefined; /** * Coerce a string to a boolean, null, undefined, or number when it matches common * literal spellings (`isNumeric` for numeric strings); otherwise returns the trimmed string. * * Keyword matching is case-insensitive (`TRUE`, `Null`, …). Empty after trim yields `""`. * * @param options.coerceBoolean - When true, also maps `yes`/`no`, `on`/`off`, `y`/`n` to booleans before numeric parsing. */ declare const parsePrimitive: (str: string, options?: { coerceBoolean?: boolean; }) => ParsedPrimitive; /** * Split a string into trimmed, non-empty parts using a delimiter. * * @param str - Input string * @param options.separator - Delimiter between values (default ",") */ declare const parseArray: (str: string, { separator, uniqueValues, }?: { separator?: string; uniqueValues?: boolean; }) => ParsedPrimitive[]; /** * * @param arg * @param options - asUTC: Use this when parsing an incomplete ISO date (e.g. "birth date") where timezone is irrelevant * @returns a JS Date object or undefined, by default parsed in local time for incomplete dates */ declare const parseDate: (arg?: Maybe, options?: { asUTC?: boolean; }) => Date | undefined; /** * * @description Given an object, returns a new object with only the keys that are in the `keys` array. * @example * const obj = { a: 1, b: 2, c: 3 }; * pickObjectKeys(obj, ["a", "c"]); // { a: 1, c: 3 } */ declare const pickObjectKeys: (obj: T, keys: ObjectKeys) => Partial; /** * * @description Given an object, returns a new object with only the keys that have the values in the `values` array. * @example * const obj = { a: 1, b: 2, c: 3 }; * pickObjectValues(obj, [1, 3]); // { a: 1, c: 3 } */ declare const pickObjectValues: (obj: T, values: ObjectValues) => Partial; declare const pluck: (items: T[], key: keyof T) => Exclude[]; declare const promiseWithTimeout: (promise: () => Promise, timeoutMs: number, error?: Error) => Promise; declare const removeUndefinedValues: (obj: PlainObject) => { [k: string]: any; }; declare const scrambleText: (str: string) => string; /** * Serialize shallow object to a deterministic string, * for nested objects use [json-stable-stringify](https://www.npmjs.com/package/json-stable-stringify) * * @example * serialize({ b: 1, a: 2 }) // '{"a":1,"b":2}' */ declare const serialize: (obj: T) => string; type AsyncFunction = () => Promise; type SeriesResult = { [K in keyof T]: T[K] extends AsyncFunction ? Awaited : never; }; /** * * @description Run a series of (async) functions in order and return the results * @example * const results = await seriesAsync([ * () => Promise.resolve(1), * () => sleep(100).then(() => 2), * () => Promise.resolve(3), * async () => 4, * ]); => [1, 2, 3, 4] */ declare const seriesAsync: (series: readonly [...T]) => Promise>; /** * Sets a value in an object using a dot-separated path. * * @param obj The object to set the value in. * @param path The path to the key to set, separated by dots. * @param value The value to set. */ declare const setObjectPath: (obj: PlainObject, path: string, value: any) => void; declare const setUrlSearchParams: (currentURL: string, searchParams?: Record>) => string; declare const shuffle: (array: T[]) => T[]; /** * Creates a lazily-initialized singleton from a factory function. * Works with both sync and async factories — the return type mirrors the factory's. * * For async factories, concurrent callers during initialization share the same * in-flight promise rather than triggering multiple factory calls. If the promise * rejects, the singleton resets so the next call retries. */ declare const singleton: (factory: () => Result) => (() => Result); declare const skipTakeToPagination: (skipTake: { skip: number; take: number; }) => { page: number; perPage: number; }; declare const sleep: (timeMs: number) => Promise; /** * Sort an array to match the order defined by key values on `field`. * * @remarks Returns a new array. Does not mutate `array`. * @example * const array = [{ id: 2, name: "Alice" }, { id: 1, name: "Bob" }, { id: 3, name: "Charlie" }]; * const sortedArray = sortBySortedKeys(array, [1, 2, 3]); * // sortedArray = [{ id: 1, name: "Bob" }, { id: 2, name: "Alice" }, { id: 3, name: "Charlie" }]; */ declare const sortBySortedKeys: >(array: T[], keys: (string | number)[], options?: { direction?: "asc" | "desc"; field?: keyof T; }) => T[]; declare const stringify: (arg?: any) => string; declare const toggleArrayValue: (array: T[], value: T) => T[]; declare const truncate: (arg: string, limit: number, { ellipsis, position, }?: { ellipsis?: string; position?: "start" | "middle" | "end"; }) => string; declare const uniqueValues: (arr: T[]) => T[]; /** * Calculates the average of a list of numbers. * @example * average([1, 2, 3, 4, 5]); // 3 * average(1, 2, 3, 4, 5); // 3 */ declare const average: (numbers: number[]) => number; /** * Counts the number of decimal places in a number. * @example * countDecimals(1.23); // 2 * countDecimals(1.234567); // 6 * countDecimals(5); // 0 * countDecimals(0.1); // 1 */ declare const countDecimals: (num: number) => number; declare const isBetween: (value: number, min: number, max: number) => boolean; declare const isOutside: (value: number, min: number, max: number) => boolean; declare const isStrictlyBetween: (value: number, min: number, max: number) => boolean; /** * Returns the maximum value in an array of numbers. * @param values - The array of numbers to find the maximum value of. * @returns The maximum value in the array. If the array is empty, returns 0. */ declare const max: (values: number[]) => number; declare const min: (values: number[]) => number; declare const multiply: (numbers: number[]) => number; /** * Normalises an array of numbers * @example normaliseArray([1, 2, 3]) => [0, 0.5, 1] */ declare const normaliseArray: (values: number[]) => number[]; /** * * @example normaliseNumber(50, 0, 100) => 0.5 */ declare const normaliseNumber: (value: number, minValue: number, maxValue: number) => number; /** * * @param previous Positive percentage i.e. 0.1 for 10% * @param current Positive percentage i.e. 0.2 for 20% * @returns */ declare const percentageChange: (previous: number, current: number) => number; declare const sum: (numbers: number[]) => number; declare const prismaDateRange: ({ startDate, endDate }: DateRange) => { gte: Date; lt: Date; }; type RandomAddress = { city: string; country: string; countryCode: string; state?: string; street: string; line2?: string; number: string; zip: string; }; declare const randomAddress: () => RandomAddress; /** * Generates a random alphanumeric code that can be used for verification codes, etc. * Does not contain 0s or Os as they get confused with each other. * @param length The length of the code to generate. * @returns A random alphanumeric code. * @example * randomAlphaNumericCode(); => "A2G4G6" */ declare const randomAlphaNumericCode: ({ length, }?: { length?: number; }) => string; declare const randomArray: () => (string | number | boolean | symbol | Date | BigInt)[]; declare const randomArrayItem: (array: T[], { weights }?: { weights?: number[]; }) => T; type BankAccount = { abaNumber?: string; accountHolderName: string; accountHolderType: "company" | "individual" | "other"; accountNumber: string; accountType?: "checking" | "savings"; bankName?: string; bsbNumber?: string; bankAddress?: string; bicSwift?: string; branchCode?: string; iban?: string; routingNumber?: string; institutionNumber?: string; branchTransitNumber?: string; sortCode?: string; }; declare const randomBankAccount: () => BankAccount; declare const randomBool: () => boolean; declare const randomChar: () => string; type Company = { name: string; vatRegNumber?: string; }; declare const randomCompany: () => Company; declare const randomCoords: () => Coords; declare const randomLat: () => number; declare const randomLng: () => number; declare const randomDate: ({ startDate, endDate }?: Partial) => Date; declare const randomMaxDate: ({ startDate, endDate }: Partial) => Date; declare const randomFutureDate: ({ startDate, endDate, }?: Partial) => Date; declare const randomPastDate: ({ startDate, endDate, }?: Partial) => Date; declare const randomDateRange: () => { endDate: Date; startDate: Date; }; declare const randomEmail: ({ handle, handleSuffix, }?: { handle?: string; handleSuffix?: string; }) => string; declare const randomEmoji: () => string; declare const randomEmptyValue: () => number | null | undefined; declare const randomEnumKey: (arg: T) => ObjectKey; declare const randomEnumValue: (arg: T) => ObjectValue; declare const randomFile: ({ name, extension, }?: { name?: string; extension?: string; }) => File | undefined; declare const JS_MAX_DIGITS = 16; declare const randomFloat: (min?: number, max?: number, decimals?: number) => number; /** * * @returns a unique social-like handle * @example "john.doe15" */ declare const randomHandle: ({ suffix }?: { suffix?: string; }) => string; declare const randomHexColor: () => string; declare const randomHexValue: () => string; declare const randomHtmlColorName: () => string; declare const randomIBAN: () => string; declare const randomInt: ({ min, max, }?: { min?: number; max?: number; }) => number; declare const randomBigInt: () => BigInt; declare const randomPositiveInt: ({ min, max, }?: { min?: number; max?: number; }) => number; declare const randomNegativeInt: ({ min, max, }?: { min?: number; max?: number; }) => number; declare const randomMaxSafeInt: () => number; declare const randomMaxInt: () => number; declare const randomFormattedPercentage: () => string; declare const randomIP: () => string; declare const randomName: () => string; declare const randomFirstName: () => string; declare const randomLastName: () => string; declare const randomFullName: () => string; /** * Generates a random numeric code that can be used for verification codes, etc. * Does not start with 0. * @param length The length of the code to generate. * @returns A random numeric code. * @example * randomNumericCode(); => "123456" * @example * randomNumericCode({ length: 4 }); => "1234" */ declare const randomNumericCode: ({ length }?: { length?: number; }) => string; declare const randomObject: ({ maxDepth, circular, }?: { maxDepth?: number; circular?: boolean; }) => PlainObject; declare const randomObjectKey: (object: T) => ObjectKey; declare const randomObjectValue: (object: T) => ObjectValue; /** * Generates a random paragraph of text. * @param maxCharacters The maximum number of characters. The paragraph will be truncated to this length if it exceeds it. Default is 200. * @param minCharacters The minimum number of characters. Words will be added beyond maxWords until this threshold is met. Default is undefined (no minimum). * @param minWords The minimum number of words. Default is 8. * @param maxWords The maximum number of words. Default is 16. * @returns A random paragraph of text. */ declare const randomParagraph: ({ maxCharacters, minCharacters, minWords, maxWords, }?: { maxCharacters?: number; minCharacters?: number; minWords?: number; maxWords?: number; }) => string; declare const randomPassword: ({ minChars, maxChars, }?: { minChars?: number; maxChars?: number; }) => string; declare const randomPath: ({ depth, }?: { depth?: number; }) => string; declare const randomPhoneNumber: () => string; declare const randomString: ({ length, }?: { length?: number; }) => string; declare const randomSymbol: () => symbol; /** * This is a light-weight version of the `generateUuid` function * To be used only for test purposed and NOT for production * Leave 0s, so it gets immediately recognized as a fake uuid * * /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i */ declare const randomUUID: () => string; declare const randomValue: () => string | number | boolean | symbol | Date | BigInt; declare const randomWord: () => string; declare const randomNoun: () => string; declare const randomVerb: () => string; declare const formatTrpcInputQueryString: (input: PlainObject) => URLSearchParams; /** * Checks if the provided argument is an array. * * @template T - The type of elements in the array. * @param arg - The value to check. * @returns True if the argument is an array, false otherwise. */ declare const isArray: (arg?: any) => arg is T[]; /** * Checks if all elements of the first array are included in the second array. * * @template T - The type of elements in the arrays. * @param arr1 - The array whose elements are to be checked for inclusion. * @param arr2 - The array to check against. * @returns True if every element in arr1 is included in arr2, false otherwise. */ declare const isArrayIncluded: (arr1: T[], arr2: T[]) => boolean; /** * Checks if a date falls between two other dates (left inclusive) * @param date The date to check * @param dateRange The date range to check against * @returns true if the date is between the start and end dates (includes startDate, excludes endDate) * * @alias isInDateRange * * @example * isBetweenDates("2023-06-15", { startDate: "2023-01-01", endDate: "2023-12-31" }) // true * isBetweenDates("2023-01-01", { startDate: "2023-01-01", endDate: "2023-12-31" }) // true (includes start) * isBetweenDates("2023-12-31", { startDate: "2023-01-01", endDate: "2023-12-31" }) // false (excludes end) */ declare const isBetweenDates: (date: DateLike, dateRange: DateRange) => boolean; declare const isInDateRange: (date: DateLike, dateRange: DateRange) => boolean; declare const isBoolean: (arg?: any) => arg is boolean; declare const isBrowser: () => boolean; declare const isBuffer: (val?: any) => boolean; declare const isClient: () => boolean; declare const isEmail: (arg: string) => boolean; declare const isEmpty: (arg?: Maybe) => boolean; declare const isEmptyString: (arg: string) => boolean; declare const isEmptyArray: (arg: any[]) => boolean; declare const isEmptyObject: (arg: PlainObject) => boolean; declare const isFile: (arg?: any) => arg is File; /** * @returns true if the argument can be called like a function -> fn() or await fn() */ declare const isFunction: (arg?: any) => arg is Function; declare const isFutureDate: (arg: DateLike, { referenceDate }?: { referenceDate?: DateLike; }) => boolean; /** * Checks if the provided argument is a valid JavaScript Date object. * * @param arg - The value to check. * @returns True if the argument is a Date object and is valid (not NaN), otherwise false. * * @example * isJsDate(new Date()); // true * isJsDate("2023-01-01"); // false * isJsDate(new Date("invalid-date")); // false */ declare const isJsDate: (arg?: any) => arg is Date; declare const isKey: (key: Key, // cannot use PlainKey here because it does not include symbol (keyof T does) obj: T) => key is keyof T; declare const isLastIndex: (index: number, array: any[]) => boolean; declare const isNotEmptyString: (arg: any) => boolean; declare const isInt: (arg?: any) => boolean; declare const isEven: (arg?: any) => boolean; declare const isOdd: (arg?: any) => boolean; declare const isPositiveInt: (arg?: any) => boolean; declare const isNegativeInt: (arg?: any) => boolean; declare const isNumber: (arg?: any) => arg is number; declare const isBigInt: (arg?: any) => arg is BigInt; declare const isBigIntString: (arg: string) => boolean; declare const isOutsideInt4: (num: number) => boolean; /** * * @example isNumeric(1) => true * @example isNumeric(10e8) => true * @example isNumeric('1') => true * @example isNumeric('1.1') => true * @example isNumeric('1.1.1') => false * @example isNumeric('1-1') => false */ declare const isNumeric: (arg: number | string) => boolean; declare const isNumericId: (id: string) => boolean; declare const isObject: (arg?: any) => arg is PlainObject; declare const isPastDate: (arg: DateLike, { referenceDate }?: { referenceDate?: DateLike; }) => boolean; declare const isPromise: (arg?: unknown) => arg is Promise; declare const isPWA: () => boolean; declare const isReactElement: (value: any) => boolean; declare const isRegExp: (arg: any) => arg is RegExp; declare const isSame: (value1: any, value2: any) => boolean; /** * Checks if two dates are on the same UTC day (year, month, day). * Returns false if either value is not a valid Date. * * @example * isSameUTCDay("2023-06-15", "2023-06-15") // true * isSameUTCDay("2023-06-15", "2023-06-16") // false * isSameUTCDay("2023-06-15", "2023-06-15T00:00:00Z") // true * isSameUTCDay("2023-06-15", "2023-06-15T00:00:00.000Z") // true */ declare const isSameUTCDay: (date1Input: DateLike, date2Input: DateLike) => boolean; /** * Check if an array of numbers is a sequence * @example * [1,2,3] = true * [0,1,2] = false (starts at 0) TODO: add option to start from different number * [1,3,4] = false (the sequence is not continuous, has gaps) * [1,1,2] = false (has repeated values) */ declare const isSequence: (numbers: number[]) => boolean; declare const isServer: () => boolean; declare const isSpacedString: (s: string) => boolean; declare const isString: (arg?: any) => arg is string; declare const isStringDate: (arg: string) => boolean; declare const isURL: (arg: string) => boolean; declare const isUUID: (arg: string) => boolean; /** * Checks if the provided argument is not null, undefined, or NaN. * * @template T * @param {Maybe} arg - The value to check. * @returns {arg is T} True if the argument is a value (not null, undefined, or NaN), otherwise false. * * @example * isValue(0); // true * isValue(""); // true * isValue(null); // false * isValue(undefined); // false * isValue(NaN); // false */ declare const isValue: (arg?: Maybe) => arg is T; export { type BoolMap, type Coords, type DateLike, type DateRange, type DateSeries, type Datey, type Defined, type Dimensions, type HashMap, type ISODate, type ISODay, type ISOMonth, type ISOYear, JS_MAX_DIGITS, type Key, type Matrix, type Maybe, type MaybePromise, type MaybePromiseOrValue, type MaybePromiseOrValueArray, type NonUndefined, type NumberMap, type ObjectEntries, type ObjectEntry, type ObjectKey, type ObjectKeys, type ObjectValue, type ObjectValues, type ParsedPrimitive, type PickDefined, type PickRequired, type PlainKey, type PlainObject, type Point, type PrismaSelect, type Serialized, type StringMap, type Timezone, type TrueMap, type VoidFn, array, arrayDiff, arrayIntersection, average, capitalize, chunkArray, chunkText, chunkedAll, chunkedAsync, chunkedDynamic, clamp, cleanSpaces, copyToClipboard, countDecimals, cyclicalItem, dir, enumKeys, enumValues, escapeSqlLikePattern, extractEmailDomain, filterAlphanumeric, first, firstKey, firstValue, formatCamelCase, formatCookies, formatCount, formatDateRange, formatFileSize, formatIndexProgress, formatInitials, formatNumber, formatPascalCase, formatPercentage, formatPercentageNumber, formatProgress, formatSlug, formatTrpcInputQueryString, getCookieByName, getCountryName, getDateRangeSeries, getDateSeriesRange, getFlagEmoji, getKeys, getUrlSearchParam, getUrlSearchParams, groupByDateBucket, groupByKey, incrementalId, isArray, isArrayIncluded, isBetween, isBetweenDates, isBigInt, isBigIntString, isBoolean, isBrowser, isBuffer, isClient, isEmail, isEmpty, isEmptyArray, isEmptyObject, isEmptyString, isEven, isFile, isFunction, isFutureDate, isInDateRange, isInt, isJsDate, isKey, isLastIndex, isNegativeInt, isNotEmptyString, isNumber, isNumeric, isNumericId, isObject, isOdd, isOutside, isOutsideInt4, isOver18, isPWA, isPastDate, isPositiveInt, isPromise, isReactElement, isRegExp, isSame, isSameUTCDay, isSequence, isServer, isSpacedString, isStrictlyBetween, isString, isStringDate, isURL, isUUID, isValue, keysLength, last, lastIndex, mapByKey, max, merge, mergeArrays, min, moveToFirst, moveToIndex, moveToLast, multiply, noop, normaliseArray, normaliseNumber, normalizeNumber, normalizeString, omit, paginationToSkipTake, parseArray, parseDate, parsePrimitive, percentageChange, pickObjectKeys, pickObjectValues, pluck, prismaDateRange, promiseWithTimeout, randomAddress, randomAlphaNumericCode, randomArray, randomArrayItem, randomBankAccount, randomBigInt, randomBool, randomChar, randomCompany, randomCoords, randomDate, randomDateRange, randomEmail, randomEmoji, randomEmptyValue, randomEnumKey, randomEnumValue, randomFile, randomFirstName, randomFloat, randomFormattedPercentage, randomFullName, randomFutureDate, randomHandle, randomHexColor, randomHexValue, randomHtmlColorName, randomIBAN, randomIP, randomInt, randomLastName, randomLat, randomLng, randomMaxDate, randomMaxInt, randomMaxSafeInt, randomName, randomNegativeInt, randomNoun, randomNumericCode, randomObject, randomObjectKey, randomObjectValue, randomParagraph, randomPassword, randomPastDate, randomPath, randomPhoneNumber, randomPositiveInt, randomString, randomSymbol, randomUUID, randomValue, randomVerb, randomWord, removeUndefinedValues, scrambleText, serialize, seriesAsync, setObjectPath, setUrlSearchParams, shuffle, singleton, skipTakeToPagination, sleep, sortBySortedKeys, startOfDay, startOfNextMonth, startOfNextWeek, startOfThisWeek, startOfToday, startOfTomorrow, startOfUTCDay, startOfUTCTomorrow, startOfYesterday, stringToCSSUnicode, stringToUnicode, stringify, sum, toggleArrayValue, truncate, uniqueValues };