export * from "./lang"; export * from "./string"; export * from "./chain"; export * from "./escape"; export * from "./unescape"; export declare function identity(v: T): T; export declare const noop: () => undefined; export declare function castArray(v?: T | T[]): T[]; /** * (Non-lodash function) Defensively create an array if not one. */ export declare function createArray(arr: any | any[]): any[]; /** * Support form: * - 'key' * - ['key', value] * - { 'key1': value1, 'key2': value2 } * - function */ export type IterateeConvertibleTypes = K | [K, T[K]] | Partial | ((item: T, index: number, collection: T[]) => Out); /** * Support form: * - 'key' * - function */ export type IterateeReturnConvertibleTypes = K | ((item: T, index: number, collection: T[]) => Out); export declare function iteratee(iter: K): (item: T, index: number, collection: T[]) => T[K]; export declare function iteratee(iter: [K, T[K]]): (item: T, index: number, collection: T[]) => boolean; export declare function iteratee(iter: Partial): (item: T, index: number, collection: T[]) => boolean; export declare function iteratee(iter: (item: T, index: number, collection: T[]) => Out): (item: T, index: number, collection: T[]) => Out; export type PredicateConvertibleTypes = string | [string, any] | Record | ((item: T) => boolean); export declare function intersectionBy(...args: readonly (T[] | IterateeConvertibleTypes)[]): T[]; export declare function intersection(...arrays: readonly T[][]): T[]; /** * Sort objects by object properties */ export declare function orderBy(arr: T[], iteratees: IterateeConvertibleTypes[], orders?: ("asc" | "desc")[]): T[]; /** * Sort objects by object properties */ export declare function sortBy(arr: T[], keys: Array): T[]; /** * Get the last element of an array */ export declare function last(arr: T[]): T | undefined; /** * Reverses array so that the first element becomes the last, the second element becomes the second to last, and so on. * Unlike lodash this does not mutate array. */ export declare function reverse(arr: T[]): T[]; /** * Get multiple object or array value by paths. Example path: `a[0].b.c` */ export declare function at(source: Record | any[], paths: string[] | string): any[]; /** * Return item by path or default value if not present */ export declare function get(source: Record | any[], path: string | number | Array, defaultValue?: T): T | undefined; export declare function set(target: Record | any[], path: string | number | Array, value?: T): typeof target; export declare function unset(target: Record | any[], path: string | number | Array): typeof target; /** * Check if an item is in an object by path */ export declare function has(source: Record | any[], path: string | Array): boolean; /** * Pick values out of an object by paths and return them in a new object */ export declare function pick>(obj: T, path: string | string[]): Partial; /** * Pick values out of an object by predicate and return them in a new object */ export declare function pickBy>(obj: T, predicate: (value: T[K], key: K) => boolean): Partial; /** * Omit values out of an object by paths and return them in a new object. * Works only on plain objects - a simplified version of lodash omit(). */ export declare function omit>(obj: T, path: string | string[]): Partial; /** * This method creates an object composed of the own and inherited numerable string keyed * properties of object that predicate doesn't return truthy for. * Works only on plain objects - a simplified version of lodash omit(). */ export declare function omitBy, K extends keyof T>(obj: T, predicate?: (item: T[K], key: K, obj: T) => boolean): Partial; /** * Loop over a collection and call the callback on each item */ export declare function forEach(value: T, callback: (value: any, index: number | string, collection: T) => void): void; /** * Flatten an array by a single level */ export declare function flatten(arr: any): any[]; /** * Creates an array of elements split into groups the length of size. */ export declare function chunk(arr: any[], size?: number): any[][]; /** * Remove falsy values from array */ export declare function compact(arr: unknown[]): any[]; /** * Generates a unique ID */ export declare function uniqueId(prefix?: string): string; export declare function once any>(fn: T): T; /** * Create a duplicate free version of an array by a user iteratee */ export declare function uniqBy(array: readonly T[], iteratee: IterateeConvertibleTypes): T[]; /** * Create a duplicate free version of an array */ export declare function uniq(arr: T[]): T[]; /** * This method is like _.uniq except that it accepts comparator which is invoked to compare elements of array. * The order of result values is determined by the order they occur in the array. * The comparator is invoked with two arguments: (arrVal, othVal). */ export declare function uniqWith(arr: T[], comparator?: (a: T, b: T) => any): T[]; export declare function differenceBy(arr: readonly T[], ...valuesRaw: readonly (T[] | IterateeConvertibleTypes)[]): T[]; /** * Creates an array of `arr` values not included in the other given arrays. * The order and references of result values are determined by the first array. */ export declare function difference(arr: readonly T[], ...values: readonly T[][]): T[]; /** * Creates an array of unique values (in-order). */ export declare function union(...arrays: readonly T[][]): T[]; /** * Creates an array of unique values (in-order), using return value of iteratee * of each item, for determining the criteria for uniqueness. */ export declare function unionBy(...args: readonly (T[] | IterateeConvertibleTypes)[]): T[]; export type AnyFunction = (...args: any[]) => any; /** * Pass the result of the first function to the next one. */ export declare function flow(...fns: AnyFunction[]): (this: any, ...args: any[]) => any; /** * Shallow clone of a value */ export declare function clone(value: T): T; /** * Deeply clone a value */ export declare function cloneDeep(value: T): T; /** * Deeply merge multiple objects */ export declare function merge(...objs: Record[]): Record; /** * Iterate the collection and return the index of the element where the predicate returns true */ export declare function findIndex(collection: T[], predicate?: PredicateConvertibleTypes, fromIndex?: number): number; /** * Iterate the collection and return the index of the last element where the predicate returns true */ export declare function findLastIndex(collection: T[], predicate?: PredicateConvertibleTypes, fromIndex?: number): number; /** * Iterate the collection and return the element where the predicate returns true */ export declare function find(collection: T[], predicate?: PredicateConvertibleTypes, fromIndex?: number): T | undefined; /** * Iterate the collection and return the last element where the predicate returns true */ export declare function findLast(collection: T[], predicate?: PredicateConvertibleTypes, fromIndex?: number): T | undefined; /** * Iterate the collection and return the elements where the predicate returns true */ export declare function filter(collection: T[], predicate?: PredicateConvertibleTypes): T[]; /** * The opposite of `filter` function; this method returns the elements of collection that predicate does not return truthy for. */ export declare function reject(collection: T[], predicate?: PredicateConvertibleTypes): T[]; /** * Creates an array of elements split into two groups, the first of which contains elements predicate returns truthy for, * the second of which contains elements predicate returns falsey for. The predicate is invoked with one argument: (value). */ export declare function partition(collection: T[], predicate?: PredicateConvertibleTypes): [T[], T[]]; /** * Iterate the collection and return true if predicate returns true for at least one element */ export declare function some(collection: T[], predicate?: PredicateConvertibleTypes): boolean; /** * Iterate the collection and return true if predicate returns true for all elements */ export declare function every(collection: T[], predicate?: PredicateConvertibleTypes): boolean; /** * Reduces collection to a value which is the accumulated result of running each element in collection thru iteratee */ export declare function reduce(collection: T[], iteratee: (K | ((item: T, index: number, collection: T[]) => unknown)) | undefined, accumulator: Out): Out; /** * Returns new collection with each element as result of it being called on iteratee function */ export declare function map(collection: T[], iteratee: K): T[K][]; export declare function map(collection: T[], iteratee?: (item: T, index: number, collection: T[]) => Out): Out[]; export declare function flatMap(collection: T[], iteratee?: K | ((item: T, index: number, collection: T[]) => Out)): Out[]; /** * Deep compare values */ export declare function isEqual(a: T, b: T): boolean; /** * Generate a range of numbers */ export declare function range(start: number, end?: number, step?: number): number[]; /** * Creates object to items in collection using keys from iteratee */ export declare function keyBy(collection: T[], iteratee: K | ((item: T, index: number, collection: T[]) => MapKey)): { [key in MapKey]: T; }; /** * Creates object to items in collection using keys from iteratee */ export declare function groupBy(collection: T[], iteratee: K | ((item: T, index: number, collection: T[]) => MapKey)): { [key in MapKey]: T[]; }; /** * Creates object using keys from iteratee */ export declare function mapKeys(object: Obj, iteratee: (value: Obj[keyof Obj], key: keyof Obj, collection: Obj) => MapKey): { [key in MapKey & string]: Obj[keyof Obj]; }; /** * Creates object using values from iteratee */ export declare function mapValues(object: Obj, iteratee: InnerKey): { [key: string]: Obj[Key][InnerKey]; }; export declare function mapValues(object: Obj, iteratee: (value: Obj[K], key: K, collection: Obj) => NewV): { [key in K]: NewV; }; /** * Recursively merge defaults from source object to target. * Unlike lodash, this implementation looks only at own properties (via Object.keys()) */ export declare function defaults(target: any, ...sources: any[]): any; /** * Recursively merge defaults from source object to target. * Unlike lodash, this implementation looks only at own properties (via Object.keys()) */ export declare function defaultsDeep(target: any, ...sources: any[]): any; /** * Clamps `number` within the inclusive `lower` and `upper` bounds. * If `upper` is skipped, then second argument is considered to be the upper bound and lower bound considered `-Infinity`. */ export declare function clamp(number: number, lower: number, upper?: number): number; /** * Checks if `number` is between `start` and up to, but not including, `end`. * If `end` is not specified, it's set to `start` with `start` then set to `0`. * If `start` is greater than `end` the params are swapped to support negative ranges. */ export declare function inRange(number: number, start: number, end?: number): boolean; export declare function sum(array: number[]): any; /** * Sums up the result of iteratee over a collection * (iteratee derives computes its value for each item of the collection) */ export declare function sumBy(array: T[], iteratee: IterateeConvertibleTypes): number; export declare function countBy(array: T[], iteratee: IterateeConvertibleTypes): { [key: string]: number; }; export declare function maxBy(array: T[], iteratee: IterateeConvertibleTypes): any; export declare function minBy(array: T[], iteratee: IterateeConvertibleTypes): any; export declare function mean(arr: number[]): number; export declare function meanBy(array: T[], iteratee: IterateeConvertibleTypes): number; export declare function invert(obj: { [key: string | number]: string | number; }): { [key: string]: string; }; export declare function invertBy(obj: { [key: string]: string | number; }, iteratee?: (val: string | number, key: string, obj2: typeof obj) => string | number): { [key: string]: string[]; }; /** * Creates an array excluding all given values using exact equality comparisons. */ export declare function without(collection: T[], ...args: T[]): T[]; /** * Creates an array of unique values that is the symmetric difference of the given arrays. * The order of result values is determined by the order they occur in the arrays. */ export declare function xor(...arrays: T[][]): T[]; /** * This method is like `_.xor` except that it accepts iteratee which is invoked for each element of each arrays * to generate the criterion by which by which they're compared. The order of result values is determined by the * order they occur in the arrays. */ export declare function xorBy(...args: (T[] | IterateeReturnConvertibleTypes)[]): T[]; export declare function zip(...arrays: any[][]): any[][]; export declare function unzip(arrays: any[][]): any[][];