/** * Sorts an array of items into groups. The return value is a map where the keys are * the group ids the given getGroupId function produced and the value is an array of * each item in that group. */ declare const group: (array: readonly T[], getGroupId: (item: T) => Key) => Partial>; /** * Creates an array of grouped elements, the first of which contains the * first elements of the given arrays, the second of which contains the * second elements of the given arrays, and so on. * * Ex. const zipped = zip(['a', 'b'], [1, 2], [true, false]) // [['a', 1, true], ['b', 2, false]] */ declare function zip(array1: T1[], array2: T2[], array3: T3[], array4: T4[], array5: T5[]): [T1, T2, T3, T4, T5][]; declare function zip(array1: T1[], array2: T2[], array3: T3[], array4: T4[]): [T1, T2, T3, T4][]; declare function zip(array1: T1[], array2: T2[], array3: T3[]): [T1, T2, T3][]; declare function zip(array1: T1[], array2: T2[]): [T1, T2][]; /** * Creates an object mapping the specified keys to their corresponding values * * Ex. const zipped = zipToObject(['a', 'b'], [1, 2]) // { a: 1, b: 2 } * Ex. const zipped = zipToObject(['a', 'b'], (k, i) => k + i) // { a: 'a0', b: 'b1' } * Ex. const zipped = zipToObject(['a', 'b'], 1) // { a: 1, b: 1 } */ declare function zipToObject(keys: K[], values: V | ((key: K, idx: number) => V) | V[]): Record; /** * Go through a list of items, starting with the first item, * and comparing with the second. Keep the one you want then * compare that to the next item in the list with the same * * Ex. const greatest = () => boil(numbers, (a, b) => a > b) */ declare const boil: (array: readonly T[], compareFunc: (a: T, b: T) => T) => T | null; /** * Sum all numbers in an array. Optionally provide a function * to convert objects in the array to number values. */ declare function sum(array: readonly T[]): number; declare function sum(array: readonly T[], fn: (item: T) => number): number; /** * Get the first item in an array or a default value */ declare const first: (array: readonly T[], defaultValue?: T | null | undefined) => T | null | undefined; /** * Get the last item in an array or a default value */ declare const last: (array: readonly T[], defaultValue?: T | null | undefined) => T | null | undefined; /** * Sort an array without modifying it and return * the newly sorted value */ declare const sort: (array: readonly T[], getter: (item: T) => number, desc?: boolean) => T[]; /** * Sort an array without modifying it and return * the newly sorted value. Allows for a string * sorting value. */ declare const alphabetical: (array: readonly T[], getter: (item: T) => string, dir?: 'asc' | 'desc') => T[]; declare const counting: (list: readonly T[], identity: (item: T) => TId) => Record; /** * Replace an element in an array with a new * item without modifying the array and return * the new value */ declare const replace: (list: readonly T[], newItem: T, match: (item: T, idx: number) => boolean) => T[]; /** * Convert an array to a dictionary by mapping each item * into a dictionary key & value */ declare const objectify: (array: readonly T[], getKey: (item: T) => Key, getValue?: (item: T) => Value) => Record; /** * Select performs a filter and a mapper inside of a reduce, * only iterating the list one time. * * @example * select([1, 2, 3, 4], x => x*x, x > 2) == [9, 16] */ declare const select: (array: readonly T[], mapper: (item: T, index: number) => K, condition: (item: T, index: number) => boolean) => K[]; /** * Max gets the greatest value from a list * * @example * max([ 2, 3, 5]) == 5 * max([{ num: 1 }, { num: 2 }], x => x.num) == { num: 2 } */ declare function max(array: readonly [number, ...number[]]): number; declare function max(array: readonly number[]): number | null; declare function max(array: readonly T[], getter: (item: T) => number): T | null; /** * Min gets the smallest value from a list * * @example * min([1, 2, 3, 4]) == 1 * min([{ num: 1 }, { num: 2 }], x => x.num) == { num: 1 } */ declare function min(array: readonly [number, ...number[]]): number; declare function min(array: readonly number[]): number | null; declare function min(array: readonly T[], getter: (item: T) => number): T | null; /** * Splits a single list into many lists of the desired size. If * given a list of 10 items and a size of 2, it will return 5 * lists with 2 items each */ declare const cluster: (list: readonly T[], size?: number) => T[][]; /** * Given a list of items returns a new list with only * unique items. Accepts an optional identity function * to convert each item in the list to a comparable identity * value */ declare const unique: (array: readonly T[], toKey?: ((item: T) => K) | undefined) => T[]; /** * Creates a generator that will produce an iteration through * the range of number as requested. * * @example * range(3) // yields 0, 1, 2, 3 * range(0, 3) // yields 0, 1, 2, 3 * range(0, 3, 'y') // yields y, y, y, y * range(0, 3, () => 'y') // yields y, y, y, y * range(0, 3, i => i) // yields 0, 1, 2, 3 * range(0, 3, i => `y${i}`) // yields y0, y1, y2, y3 * range(0, 3, obj) // yields obj, obj, obj, obj * range(0, 6, i => i, 2) // yields 0, 2, 4, 6 */ declare function range(startOrLength: number, end?: number, valueOrMapper?: T | ((i: number) => T), step?: number): Generator; /** * Creates a list of given start, end, value, and * step parameters. * * @example * list(3) // 0, 1, 2, 3 * list(0, 3) // 0, 1, 2, 3 * list(0, 3, 'y') // y, y, y, y * list(0, 3, () => 'y') // y, y, y, y * list(0, 3, i => i) // 0, 1, 2, 3 * list(0, 3, i => `y${i}`) // y0, y1, y2, y3 * list(0, 3, obj) // obj, obj, obj, obj * list(0, 6, i => i, 2) // 0, 2, 4, 6 */ declare const list: (startOrLength: number, end?: number, valueOrMapper?: T | ((i: number) => T) | undefined, step?: number) => T[]; /** * Given an array of arrays, returns a single * dimentional array with all items in it. */ declare const flat: (lists: readonly T[][]) => T[]; /** * Given two arrays, returns true if any * elements intersect */ declare const intersects: (listA: readonly T[], listB: readonly T[], identity?: ((t: T) => K) | undefined) => boolean; /** * Split an array into two array based on * a true/false condition function */ declare const fork: (list: readonly T[], condition: (item: T) => boolean) => [T[], T[]]; /** * Given two lists of the same type, iterate the first list * and replace items matched by the matcher func in the * first place. */ declare const merge: (root: readonly T[], others: readonly T[], matcher: (item: T) => any) => readonly T[]; /** * Replace an item in an array by a match function condition. If * no items match the function condition, appends the new item to * the end of the list. */ declare const replaceOrAppend: (list: readonly T[], newItem: T, match: (a: T, idx: number) => boolean) => T[]; /** * If the item matching the condition already exists * in the list it will be removed. If it does not it * will be added. */ declare const toggle: (list: readonly T[], item: T, toKey?: ((item: T, idx: number) => number | string | symbol) | null | undefined, options?: { strategy?: 'prepend' | 'append'; }) => T[]; type Falsy = null | undefined | false | '' | 0 | 0n; /** * Given a list returns a new list with * only truthy values */ declare const sift: (list: readonly (Falsy | T)[]) => T[]; /** * Like a reduce but does not require an array. * Only need a number and will iterate the function * as many times as specified. * * NOTE: This is NOT zero indexed. If you pass count=5 * you will get 1, 2, 3, 4, 5 iteration in the callback * function */ declare const iterate: (count: number, func: (currentValue: T, iteration: number) => T, initValue: T) => T; /** * Returns all items from the first list that * do not exist in the second list. */ declare const diff: (root: readonly T[], other: readonly T[], identity?: (item: T) => string | number | symbol) => T[]; /** * Shift array items by n steps * If n > 0 items will shift n steps to the right * If n < 0 items will shift n steps to the left */ declare function shift(arr: Array, n: number): T[]; /** * An async reduce function. Works like the * built-in Array.reduce function but handles * an async reducer function */ declare const reduce: (array: readonly T[], asyncReducer: (acc: K, item: T, index: number) => Promise, initValue?: K | undefined) => Promise; /** * An async map function. Works like the * built-in Array.map function but handles * an async mapper function */ declare const map: (array: readonly T[], asyncMapFunc: (item: T, index: number) => Promise) => Promise; /** * Useful when for script like things where cleanup * should be done on fail or sucess no matter. * * You can call defer many times to register many * defered functions that will all be called when * the function exits in any state. */ declare const defer: (func: (register: (fn: (error?: any) => any, options?: { rethrow?: boolean; }) => void) => Promise) => Promise; /** * Support for the built-in AggregateError * is still new. Node < 15 doesn't have it * so patching here. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError#browser_compatibility */ declare class AggregateError extends Error { errors: Error[]; constructor(errors?: Error[]); } /** * Executes many async functions in parallel. Returns the * results from all functions as an array. After all functions * have resolved, if any errors were thrown, they are rethrown * in an instance of AggregateError */ declare const parallel: (limit: number, array: readonly T[], func: (item: T) => Promise) => Promise; type PromiseValues[]> = { [K in keyof T]: T[K] extends Promise ? U : never; }; /** * Functionally similar to Promise.all or Promise.allSettled. If any * errors are thrown, all errors are gathered and thrown in an * AggregateError. * * @example * const [user] = await all([ * api.users.create(...), * s3.buckets.create(...), * slack.customerSuccessChannel.sendMessage(...) * ]) */ declare function all, ...Promise[]]>(promises: T): Promise>; declare function all[]>(promises: T): Promise>; /** * Functionally similar to Promise.all or Promise.allSettled. If any * errors are thrown, all errors are gathered and thrown in an * AggregateError. * * @example * const { user } = await all({ * user: api.users.create(...), * bucket: s3.buckets.create(...), * message: slack.customerSuccessChannel.sendMessage(...) * }) */ declare function all>>(promises: T): Promise<{ [K in keyof T]: Awaited; }>; /** * Retries the given function the specified number * of times. */ declare const retry: (options: { times?: number | undefined; delay?: number | null | undefined; backoff?: ((count: number) => number) | undefined; }, func: (exit: (err: any) => void) => Promise) => Promise; /** * Async wait */ declare const sleep: (milliseconds: number) => Promise; /** * A helper to try an async function without forking * the control flow. Returns an error first callback _like_ * array response as [Error, result] */ declare const tryit: (func: (...args: Args) => Return) => (...args: Args) => Return extends Promise ? Promise<[Error, undefined] | [undefined, Awaited]> : [Error, undefined] | [undefined, Return]; /** * A helper to try an async function that returns undefined * if it fails. * * e.g. const result = await guard(fetchUsers)() ?? []; */ declare const guard: any>(func: TFunction, shouldGuard?: ((err: any) => boolean) | undefined) => ReturnType extends Promise ? Promise> | undefined> : ReturnType | undefined; declare function chain(f1: (...arg: T1) => T2, f2: (arg: T2) => T3): (...arg: T1) => T3; declare function chain(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4): (...arg: T1) => T4; declare function chain(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5): (...arg: T1) => T5; declare function chain(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6): (...arg: T1) => T6; declare function chain(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6, f6: (arg: T3) => T7): (...arg: T1) => T7; declare function chain(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6, f6: (arg: T3) => T7, f7: (arg: T3) => T8): (...arg: T1) => T8; declare function chain(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6, f6: (arg: T3) => T7, f7: (arg: T3) => T8, f8: (arg: T3) => T9): (...arg: T1) => T9; declare function chain(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6, f6: (arg: T3) => T7, f7: (arg: T3) => T8, f8: (arg: T3) => T9, f9: (arg: T3) => T10): (...arg: T1) => T10; declare function chain(f1: (...arg: T1) => T2, f2: (arg: T2) => T3, f3: (arg: T3) => T4, f4: (arg: T3) => T5, f5: (arg: T3) => T6, f6: (arg: T3) => T7, f7: (arg: T3) => T8, f8: (arg: T3) => T9, f9: (arg: T3) => T10, f10: (arg: T3) => T11): (...arg: T1) => T11; declare function compose(f1: (next: (...args: F1NextArgs) => LastResult) => (...args: F1Args) => F1Result, last: (...args: F1NextArgs) => LastResult): (...args: F1Args) => F1Result; declare function compose(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => LastResult) => (...args: F1NextArgs) => F2Result, last: (...args: F2NextArgs) => LastResult): (...args: F1Args) => F1Result; declare function compose(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => LastResult) => (...args: F2NextArgs) => F3Result, last: (...args: F3NextArgs) => LastResult): (...args: F1Args) => F1Result; declare function compose(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => LastResult) => (...args: F3NextArgs) => F4Result, last: (...args: F4NextArgs) => LastResult): (...args: F1Args) => F1Result; declare function compose(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => F5Result) => (...args: F3NextArgs) => F4Result, f5: (next: (...args: F5NextArgs) => LastResult) => (...args: F4NextArgs) => F5Result, last: (...args: F5NextArgs) => LastResult): (...args: F1Args) => F1Result; declare function compose(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => F5Result) => (...args: F3NextArgs) => F4Result, f5: (next: (...args: F5NextArgs) => F6Result) => (...args: F4NextArgs) => F5Result, f6: (next: (...args: F6NextArgs) => LastResult) => (...args: F5NextArgs) => F6Result, last: (...args: F6NextArgs) => LastResult): (...args: F1Args) => F1Result; declare function compose(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => F5Result) => (...args: F3NextArgs) => F4Result, f5: (next: (...args: F5NextArgs) => F6Result) => (...args: F4NextArgs) => F5Result, f6: (next: (...args: F6NextArgs) => F7Result) => (...args: F5NextArgs) => F6Result, f7: (next: (...args: F7NextArgs) => LastResult) => (...args: F6NextArgs) => F7Result, last: (...args: F7NextArgs) => LastResult): (...args: F1Args) => F1Result; declare function compose(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => F5Result) => (...args: F3NextArgs) => F4Result, f5: (next: (...args: F5NextArgs) => F6Result) => (...args: F4NextArgs) => F5Result, f6: (next: (...args: F6NextArgs) => F7Result) => (...args: F5NextArgs) => F6Result, f7: (next: (...args: F7NextArgs) => LastResult) => (...args: F6NextArgs) => F7Result, f8: (next: (...args: F8NextArgs) => LastResult) => (...args: F7NextArgs) => F8Result, last: (...args: F8NextArgs) => LastResult): (...args: F1Args) => F1Result; declare function compose(f1: (next: (...args: F1NextArgs) => F2Result) => (...args: F1Args) => F1Result, f2: (next: (...args: F2NextArgs) => F3Result) => (...args: F1NextArgs) => F2Result, f3: (next: (...args: F3NextArgs) => F4Result) => (...args: F2NextArgs) => F3Result, f4: (next: (...args: F4NextArgs) => F5Result) => (...args: F3NextArgs) => F4Result, f5: (next: (...args: F5NextArgs) => F6Result) => (...args: F4NextArgs) => F5Result, f6: (next: (...args: F6NextArgs) => F7Result) => (...args: F5NextArgs) => F6Result, f7: (next: (...args: F7NextArgs) => LastResult) => (...args: F6NextArgs) => F7Result, f8: (next: (...args: F8NextArgs) => LastResult) => (...args: F7NextArgs) => F8Result, f9: (next: (...args: F9NextArgs) => LastResult) => (...args: F8NextArgs) => F9Result, last: (...args: F9NextArgs) => LastResult): (...args: F1Args) => F1Result; /** * This type produces the type array of TItems with all the type items * in TItemsToRemove removed from the start of the array type. * * @example * ``` * RemoveItemsInFront<[number, number], [number]> = [number] * RemoveItemsInFront<[File, number, string], [File, number]> = [string] * ``` */ type RemoveItemsInFront = TItems extends [...TItemsToRemove, ...infer TRest] ? TRest : TItems; declare const partial: , R>(fn: (...args: T) => R, ...args: TA) => (...rest: RemoveItemsInFront) => R; /** * Like partial but for unary functions that accept * a single object argument */ declare const partob: >(fn: (args: T) => K, argobj: PartialArgs) => (restobj: Omit) => K; /** * Creates a Proxy object that will dynamically * call the handler argument when attributes are * accessed */ declare const proxied: (handler: (propertyName: T) => K) => Record; /** * Creates a memoized function. The returned function * will only execute the source function when no value * has previously been computed. If a ttl (milliseconds) * is given previously computed values will be checked * for expiration before being returned. */ declare const memo: (func: (...args: TArgs) => TResult, options?: { key?: ((...args: TArgs) => string) | undefined; ttl?: number | undefined; }) => (...args: TArgs) => TResult; type DebounceFunction = { (...args: TArgs): void; /** * Cancels the debounced function */ cancel(): void; /** * Checks if there is any invocation debounced */ isPending(): boolean; /** * Runs the debounced function immediately */ flush(...args: TArgs): void; }; type ThrottledFunction = { (...args: TArgs): void; /** * Checks if there is any invocation throttled */ isThrottled(): boolean; }; /** * Given a delay and a function returns a new function * that will only call the source function after delay * milliseconds have passed without any invocations. * * The debounce function comes with a `cancel` method * to cancel delayed `func` invocations and a `flush` * method to invoke them immediately */ declare const debounce: ({ delay }: { delay: number; }, func: (...args: TArgs) => any) => DebounceFunction; /** * Given an interval and a function returns a new function * that will only call the source function if interval milliseconds * have passed since the last invocation */ declare const throttle: ({ interval }: { interval: number; }, func: (...args: TArgs) => any) => ThrottledFunction; /** * Make an object callable. Given an object and a function * the returned object will be a function with all the * objects properties. * * @example * ```typescript * const car = callable({ * wheels: 2 * }, self => () => { * return 'driving' * }) * * car.wheels // => 2 * car() // => 'driving' * ``` */ declare const callable: , TFunc extends (...args: any) => any>(obj: TObj, fn: (self: TObj) => TFunc) => TObj & TFunc; /** * Checks if the given number is between zero (0) and the ending number. 0 is inclusive. * * * Numbers can be negative or positive. * * Ending number is exclusive. * * @param {number} number The number to check. * @param {number} end The end of the range. Exclusive. * @returns {boolean} Returns `true` if `number` is in the range, else `false`. */ declare function inRange(number: number, end: number): boolean; /** * Checks if the given number is between two numbers. * * * Numbers can be negative or positive. * * Starting number is inclusive. * * Ending number is exclusive. * * The start and the end of the range can be ascending OR descending order. * * @param {number} number The number to check. * @param {number} start The start of the range. Inclusive. * @param {number} end The end of the range. Exclusive. * @returns {boolean} Returns `true` if `number` is in the range, else `false`. */ declare function inRange(number: number, start: number, end: number): boolean; declare const toFloat: (value: any, defaultValue?: T | undefined) => number | T; declare const toInt: (value: any, defaultValue?: T | undefined) => number | T; type LowercasedKeys> = { [P in keyof T & string as Lowercase

]: T[P]; }; type UppercasedKeys> = { [P in keyof T & string as Uppercase

]: T[P]; }; /** * Removes (shakes out) undefined entries from an * object. Optional second argument shakes out values * by custom evaluation. */ declare const shake: (obj: T, filter?: (value: any) => boolean) => Omit; /** * Map over all the keys of an object to return * a new object */ declare const mapKeys: (obj: Record, mapFunc: (key: TKey, value: TValue) => TNewKey) => Record; /** * Map over all the keys to create a new object */ declare const mapValues: (obj: Record, mapFunc: (value: TValue, key: TKey) => TNewValue) => Record; /** * Map over all the keys to create a new object */ declare const mapEntries: (obj: Record, toEntry: (key: TKey, value: TValue) => [TNewKey, TNewValue]) => Record; /** * Returns an object with { [keys]: value } * inverted as { [value]: key } */ declare const invert: (obj: Record) => Record; /** * Convert all keys in an object to lower case */ declare const lowerize: >(obj: T) => LowercasedKeys; /** * Convert all keys in an object to upper case */ declare const upperize: >(obj: T) => UppercasedKeys; /** * Creates a shallow copy of the given obejct/value. * @param {*} obj value to clone * @returns {*} shallow clone of the given value */ declare const clone: (obj: T) => T; /** * Convert an object to a list, mapping each entry * into a list item */ declare const listify: (obj: Record, toItem: (key: TKey, value: TValue) => KResult) => KResult[]; /** * Pick a list of properties from an object * into a new object */ declare const pick: (obj: T, keys: TKeys[]) => Pick; /** * Omit a list of properties from an object * returning a new object with the properties * that remain */ declare const omit: (obj: T, keys: TKeys[]) => Omit; /** * Dynamically get a nested value from an array or * object with a string. * * @example get(person, 'friends[0].name') */ declare const get: (value: any, path: string, defaultValue?: TDefault | undefined) => TDefault; /** * Opposite of get, dynamically set a nested value into * an object using a key path. Does not modify the given * initial object. * * @example * set({}, 'name', 'ra') // => { name: 'ra' } * set({}, 'cards[0].value', 2) // => { cards: [{ value: 2 }] } */ declare const set: (initial: T, path: string, value: K) => T; /** * Merges two objects together recursivly into a new * object applying values from right to left. * Recursion only applies to child object properties. */ declare const assign: >(initial: X, override: X) => X; /** * Get a string list of all key names that exist in * an object (deep). * * @example * keys({ name: 'ra' }) // ['name'] * keys({ name: 'ra', children: [{ name: 'hathor' }] }) // ['name', 'children.0.name'] */ declare const keys: (value: TValue) => string[]; /** * Flattens a deep object to a single demension, converting * the keys to dot notation. * * @example * crush({ name: 'ra', children: [{ name: 'hathor' }] }) * // { name: 'ra', 'children.0.name': 'hathor' } */ declare const crush: (value: TValue) => object; /** * The opposite of crush, given an object that was * crushed into key paths and values will return * the original object reconstructed. * * @example * construct({ name: 'ra', 'children.0.name': 'hathor' }) * // { name: 'ra', children: [{ name: 'hathor' }] } */ declare const construct: (obj: TObject) => object; /** * Generates a random number between min and max */ declare const random: (min: number, max: number) => number; /** * Draw a random item from a list. Returns * null if the list is empty */ declare const draw: (array: readonly T[]) => T | null; declare const shuffle: (array: readonly T[]) => T[]; declare const uid: (length: number, specials?: string) => string; /** * Creates a series object around a list of values * that should be treated with order. */ declare const series: (items: T[], toKey?: (item: T) => string | symbol) => { min: (a: T, b: T) => T; max: (a: T, b: T) => T; first: () => T; last: () => T; next: (current: T, defaultValue?: T | undefined) => T; previous: (current: T, defaultValue?: T | undefined) => T; spin: (current: T, num: number) => T; }; /** * Capitalize the first word of the string * * capitalize('hello') -> 'Hello' * capitalize('va va voom') -> 'Va va voom' */ declare const capitalize: (str: string) => string; /** * Formats the given string in camel case fashion * * camel('hello world') -> 'helloWorld' * camel('va va-VOOM') -> 'vaVaVoom' * camel('helloWorld') -> 'helloWorld' */ declare const camel: (str: string) => string; /** * Formats the given string in snake case fashion * * snake('hello world') -> 'hello_world' * snake('va va-VOOM') -> 'va_va_voom' * snake('helloWord') -> 'hello_world' */ declare const snake: (str: string, options?: { splitOnNumber?: boolean; }) => string; /** * Formats the given string in dash case fashion * * dash('hello world') -> 'hello-world' * dash('va va_VOOM') -> 'va-va-voom' * dash('helloWord') -> 'hello-word' */ declare const dash: (str: string) => string; /** * Formats the given string in pascal case fashion * * pascal('hello world') -> 'HelloWorld' * pascal('va va boom') -> 'VaVaBoom' */ declare const pascal: (str: string) => string; /** * Formats the given string in title case fashion * * title('hello world') -> 'Hello World' * title('va_va_boom') -> 'Va Va Boom' * title('root-hook') -> 'Root Hook' * title('queryItems') -> 'Query Items' */ declare const title: (str: string | null | undefined) => string; /** * template is used to replace data by name in template strings. * The default expression looks for {{name}} to identify names. * * Ex. template('Hello, {{name}}', { name: 'ray' }) * Ex. template('Hello, ', { name: 'ray' }, /<(.+?)>/g) */ declare const template: (str: string, data: Record, regex?: RegExp) => string; /** * Trims all prefix and suffix characters from the given * string. Like the builtin trim function but accepts * other characters you would like to trim and trims * multiple characters. * * ```typescript * trim(' hello ') // => 'hello' * trim('__hello__', '_') // => 'hello' * trim('/repos/:owner/:repo/', '/') // => 'repos/:owner/:repo' * trim('222222__hello__1111111', '12_') // => 'hello' * ``` */ declare const trim: (str: string | null | undefined, charsToTrim?: string) => string; declare const isSymbol: (value: any) => value is symbol; declare const isArray: (arg: any) => arg is any[]; declare const isObject: (value: any) => value is object; /** * Checks if the given value is primitive. * * Primitive Types: number , string , boolean , symbol, bigint, undefined, null * * @param {*} value value to check * @returns {boolean} result */ declare const isPrimitive: (value: any) => boolean; declare const isFunction: (value: any) => value is Function; declare const isString: (value: any) => value is string; declare const isInt: (value: any) => value is number; declare const isFloat: (value: any) => value is number; declare const isNumber: (value: any) => value is number; declare const isDate: (value: any) => value is Date; /** * This is really a _best guess_ promise checking. You * should probably use Promise.resolve(value) to be 100% * sure you're handling it correctly. */ declare const isPromise: (value: any) => value is Promise; declare const isEmpty: (value: any) => boolean; declare const isEqual: (x: TType, y: TType) => boolean; export { AggregateError, all, alphabetical, assign, boil, callable, camel, capitalize, chain, clone, cluster, compose, construct, counting, crush, dash, debounce, defer, diff, draw, first, flat, fork, get, group, guard, inRange, intersects, invert, isArray, isDate, isEmpty, isEqual, isFloat, isFunction, isInt, isNumber, isObject, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, lowerize, map, mapEntries, mapKeys, mapValues, max, memo, merge, min, objectify, omit, parallel, partial, partob, pascal, pick, proxied, random, range, reduce, replace, replaceOrAppend, retry, select, series, set, shake, shift, shuffle, sift, sleep, snake, sort, sum, template, throttle, title, toFloat, toInt, toggle, trim, tryit as try, tryit, uid, unique, upperize, zip, zipToObject };