UNPKG

qw-utils-vanguard

Version:

qw Utils package

175 lines (174 loc) 14.5 kB
import _ from 'lodash'; /** * lodash库工具类 */ export declare class lodashUtils { constructor(); static chunk: <T>(array: _.List<T> | null | undefined, size?: number | undefined) => T[][]; static compact: <T>(array: _.List<_.Falsey | T> | null | undefined) => T[]; static difference: <T>(array: _.List<T> | null | undefined, ...values: _.List<T>[]) => T[]; static filter: { (collection: string | null | undefined, predicate?: _.StringIterator<boolean> | undefined): string[]; <T, S extends T>(collection: _.List<T> | null | undefined, predicate: _.ListIteratorTypeGuard<T, S>): S[]; <T_1>(collection: _.List<T_1> | null | undefined, predicate?: _.ListIterateeCustom<T_1, boolean> | undefined): T_1[]; <T_2 extends object, S_1 extends T_2[keyof T_2]>(collection: T_2 | null | undefined, predicate: _.ObjectIteratorTypeGuard<T_2, S_1>): S_1[]; <T_3 extends object>(collection: T_3 | null | undefined, predicate?: _.ObjectIterateeCustom<T_3, boolean> | undefined): T_3[keyof T_3][]; }; static find: { <T, S extends T>(collection: _.List<T> | null | undefined, predicate: _.ListIteratorTypeGuard<T, S>, fromIndex?: number | undefined): S | undefined; <T_1>(collection: _.List<T_1> | null | undefined, predicate?: _.ListIterateeCustom<T_1, boolean> | undefined, fromIndex?: number | undefined): T_1 | undefined; <T_2 extends object, S_1 extends T_2[keyof T_2]>(collection: T_2 | null | undefined, predicate: _.ObjectIteratorTypeGuard<T_2, S_1>, fromIndex?: number | undefined): S_1 | undefined; <T_3 extends object>(collection: T_3 | null | undefined, predicate?: _.ObjectIterateeCustom<T_3, boolean> | undefined, fromIndex?: number | undefined): T_3[keyof T_3] | undefined; }; static findIndex: <T>(array: _.List<T> | null | undefined, predicate?: _.ListIterateeCustom<T, boolean> | undefined, fromIndex?: number | undefined) => number; static forEach: { <T>(collection: T[], iteratee?: _.ArrayIterator<T, any> | undefined): T[]; (collection: string, iteratee?: _.StringIterator<any> | undefined): string; <T_1>(collection: _.List<T_1>, iteratee?: _.ListIterator<T_1, any> | undefined): _.List<T_1>; <T_2 extends object>(collection: T_2, iteratee?: _.ObjectIterator<T_2, any> | undefined): T_2; <T_3, TArray extends T_3[] | null | undefined>(collection: TArray & (T_3[] | null | undefined), iteratee?: _.ArrayIterator<T_3, any> | undefined): TArray; <TString extends string | null | undefined>(collection: TString, iteratee?: _.StringIterator<any> | undefined): TString; <T_4, TList extends _.List<T_4> | null | undefined>(collection: TList & (_.List<T_4> | null | undefined), iteratee?: _.ListIterator<T_4, any> | undefined): TList; <T_5 extends object>(collection: T_5 | null | undefined, iteratee?: _.ObjectIterator<T_5, any> | undefined): T_5 | null | undefined; }; static groupBy: { <T>(collection: _.List<T> | null | undefined, iteratee?: _.ValueIteratee<T> | undefined): _.Dictionary<T[]>; <T_1 extends object>(collection: T_1 | null | undefined, iteratee?: _.ValueIteratee<T_1[keyof T_1]> | undefined): _.Dictionary<T_1[keyof T_1][]>; }; static includes: <T>(collection: _.Dictionary<T> | _.NumericDictionary<T> | null | undefined, target: T, fromIndex?: number | undefined) => boolean; static intersection: <T>(...arrays: (_.List<T> | null | undefined)[]) => T[]; static isEmpty: { <T extends { __trapAny: any; }>(value?: T | undefined): boolean; (value: string): value is ""; (value: Map<any, any> | Set<any> | _.List<any> | null | undefined): boolean; (value: object): boolean; <T_1 extends object>(value: T_1 | null | undefined): value is _.EmptyObjectOf<T_1> | null | undefined; (value?: any): boolean; }; static isEqual: (value: any, other: any) => boolean; static join: (array: _.List<any> | null | undefined, separator?: string | undefined) => string; static keyBy: { <T>(collection: _.List<T> | null | undefined, iteratee?: _.ValueIterateeCustom<T, _.PropertyName> | undefined): _.Dictionary<T>; <T_1 extends object>(collection: T_1 | null | undefined, iteratee?: _.ValueIterateeCustom<T_1[keyof T_1], _.PropertyName> | undefined): _.Dictionary<T_1[keyof T_1]>; }; static last: <T>(array: _.List<T> | null | undefined) => T | undefined; static map: { <T, TResult>(collection: T[] | null | undefined, iteratee: _.ArrayIterator<T, TResult>): TResult[]; <T_1, TResult_1>(collection: _.List<T_1> | null | undefined, iteratee: _.ListIterator<T_1, TResult_1>): TResult_1[]; <T_2>(collection: _.Dictionary<T_2> | _.NumericDictionary<T_2> | null | undefined): T_2[]; <T_3 extends object, TResult_2>(collection: T_3 | null | undefined, iteratee: _.ObjectIterator<T_3, TResult_2>): TResult_2[]; <T_4, K extends keyof T_4>(collection: _.Dictionary<T_4> | _.NumericDictionary<T_4> | null | undefined, iteratee: K): T_4[K][]; <T_5>(collection: _.Dictionary<T_5> | _.NumericDictionary<T_5> | null | undefined, iteratee?: string | undefined): any[]; <T_6>(collection: _.Dictionary<T_6> | _.NumericDictionary<T_6> | null | undefined, iteratee?: object | undefined): boolean[]; }; static orderBy: { <T>(collection: _.List<T> | null | undefined, iteratees?: _.Many<_.ListIterator<T, unknown>> | undefined, orders?: _.Many<boolean | "desc" | "asc"> | undefined): T[]; <T_1>(collection: _.List<T_1> | null | undefined, iteratees?: _.Many<_.ListIteratee<T_1>> | undefined, orders?: _.Many<boolean | "desc" | "asc"> | undefined): T_1[]; <T_2 extends object>(collection: T_2 | null | undefined, iteratees?: _.Many<_.ObjectIterator<T_2, unknown>> | undefined, orders?: _.Many<boolean | "desc" | "asc"> | undefined): T_2[keyof T_2][]; <T_3 extends object>(collection: T_3 | null | undefined, iteratees?: _.Many<_.ObjectIteratee<T_3>> | undefined, orders?: _.Many<boolean | "desc" | "asc"> | undefined): T_3[keyof T_3][]; }; static partition: { <T, U extends T>(collection: _.List<T> | null | undefined, callback: _.ValueIteratorTypeGuard<T, U>): [U[], Exclude<T, U>[]]; <T_1>(collection: _.List<T_1> | null | undefined, callback: _.ValueIteratee<T_1>): [T_1[], T_1[]]; <T_2 extends object>(collection: T_2 | null | undefined, callback: _.ValueIteratee<T_2[keyof T_2]>): [T_2[keyof T_2][], T_2[keyof T_2][]]; }; static reduce: { <T, TResult>(collection: T[] | null | undefined, callback: _.MemoListIterator<T, TResult, T[]>, accumulator: TResult): TResult; <T_1, TResult_1>(collection: _.List<T_1> | null | undefined, callback: _.MemoListIterator<T_1, TResult_1, _.List<T_1>>, accumulator: TResult_1): TResult_1; <T_2 extends object, TResult_2>(collection: T_2 | null | undefined, callback: _.MemoObjectIterator<T_2[keyof T_2], TResult_2, T_2>, accumulator: TResult_2): TResult_2; <T_3>(collection: T_3[] | null | undefined, callback: _.MemoListIterator<T_3, T_3, T_3[]>): T_3 | undefined; <T_4>(collection: _.List<T_4> | null | undefined, callback: _.MemoListIterator<T_4, T_4, _.List<T_4>>): T_4 | undefined; <T_5 extends object>(collection: T_5 | null | undefined, callback: _.MemoObjectIterator<T_5[keyof T_5], T_5[keyof T_5], T_5>): T_5[keyof T_5] | undefined; }; static reverse: <TList extends _.List<any>>(array: TList) => TList; static sample: { <T>(collection: _.Dictionary<T> | _.NumericDictionary<T> | null | undefined): T | undefined; <T_1 extends object>(collection: T_1 | null | undefined): T_1[keyof T_1] | undefined; }; static shuffle: { <T>(collection: _.List<T> | null | undefined): T[]; <T_1 extends object>(collection: T_1 | null | undefined): T_1[keyof T_1][]; }; static size: (collection: string | object | null | undefined) => number; static sortBy: { <T>(collection: _.List<T> | null | undefined, ...iteratees: _.Many<_.ListIteratee<T>>[]): T[]; <T_1 extends object>(collection: T_1 | null | undefined, ...iteratees: _.Many<_.ObjectIteratee<T_1>>[]): T_1[keyof T_1][]; }; static take: <T>(array: _.List<T> | null | undefined, n?: number | undefined) => T[]; static takeRight: <T>(array: _.List<T> | null | undefined, n?: number | undefined) => T[]; static toArray: { <T>(value: _.Dictionary<T> | _.NumericDictionary<T> | null | undefined): T[]; <T_1>(value: T_1): T_1[keyof T_1][]; (): any[]; }; static uniq: <T>(array: _.List<T> | null | undefined) => T[]; static without: <T>(array: _.List<T> | null | undefined, ...values: T[]) => T[]; static throttle: <T extends (...args: any) => any>(func: T, wait?: number | undefined, options?: _.ThrottleSettings | undefined) => _.DebouncedFunc<T>; static debounce: { <T extends (...args: any) => any>(func: T, wait: number | undefined, options: _.DebounceSettingsLeading): _.DebouncedFuncLeading<T>; <T_1 extends (...args: any) => any>(func: T_1, wait?: number | undefined, options?: _.DebounceSettings | undefined): _.DebouncedFunc<T_1>; }; static camelCase: (string?: string | undefined) => string; static pickBy: { <T, S extends T>(object: _.Dictionary<T> | null | undefined, predicate: _.ValueKeyIterateeTypeGuard<T, S>): _.Dictionary<S>; <T_1, S_1 extends T_1>(object: _.NumericDictionary<T_1> | null | undefined, predicate: _.ValueKeyIterateeTypeGuard<T_1, S_1>): _.NumericDictionary<S_1>; <T_2>(object: _.Dictionary<T_2> | null | undefined, predicate?: _.ValueKeyIteratee<T_2> | undefined): _.Dictionary<T_2>; <T_3>(object: _.NumericDictionary<T_3> | null | undefined, predicate?: _.ValueKeyIteratee<T_3> | undefined): _.NumericDictionary<T_3>; <T_4 extends object>(object: T_4 | null | undefined, predicate?: _.ValueKeyIteratee<T_4[keyof T_4]> | undefined): Partial<T_4>; }; static merge: { <TObject, TSource>(object: TObject, source: TSource): TObject & TSource; <TObject_1, TSource1, TSource2>(object: TObject_1, source1: TSource1, source2: TSource2): TObject_1 & TSource1 & TSource2; <TObject_2, TSource1_1, TSource2_1, TSource3>(object: TObject_2, source1: TSource1_1, source2: TSource2_1, source3: TSource3): TObject_2 & TSource1_1 & TSource2_1 & TSource3; <TObject_3, TSource1_2, TSource2_2, TSource3_1, TSource4>(object: TObject_3, source1: TSource1_2, source2: TSource2_2, source3: TSource3_1, source4: TSource4): TObject_3 & TSource1_2 & TSource2_2 & TSource3_1 & TSource4; (object: any, ...otherArgs: any[]): any; }; static countBy: { <T>(collection: _.List<T> | null | undefined, iteratee?: _.ValueIteratee<T> | undefined): _.Dictionary<number>; <T_1 extends object>(collection: T_1 | null | undefined, iteratee?: _.ValueIteratee<T_1[keyof T_1]> | undefined): _.Dictionary<number>; }; static pick: { <T extends object, U extends keyof T>(object: T, ...props: _.Many<U>[]): Pick<T, U>; <T_1>(object: T_1 | null | undefined, ...props: _.Many<_.PropertyPath>[]): Partial<T_1>; }; static assign: { <TObject, TSource>(object: TObject, source: TSource): TObject & TSource; <TObject_1, TSource1, TSource2>(object: TObject_1, source1: TSource1, source2: TSource2): TObject_1 & TSource1 & TSource2; <TObject_2, TSource1_1, TSource2_1, TSource3>(object: TObject_2, source1: TSource1_1, source2: TSource2_1, source3: TSource3): TObject_2 & TSource1_1 & TSource2_1 & TSource3; <TObject_3, TSource1_2, TSource2_2, TSource3_1, TSource4>(object: TObject_3, source1: TSource1_2, source2: TSource2_2, source3: TSource3_1, source4: TSource4): TObject_3 & TSource1_2 & TSource2_2 & TSource3_1 & TSource4; <TObject_4>(object: TObject_4): TObject_4; (object: any, ...otherArgs: any[]): any; }; static flatten: <T>(array: _.List<_.Many<T>> | null | undefined) => T[]; static defaults: { <TObject, TSource>(object: TObject, source: TSource): NonNullable<TSource & TObject>; <TObject_1, TSource1, TSource2>(object: TObject_1, source1: TSource1, source2: TSource2): NonNullable<TSource2 & TSource1 & TObject_1>; <TObject_2, TSource1_1, TSource2_1, TSource3>(object: TObject_2, source1: TSource1_1, source2: TSource2_1, source3: TSource3): NonNullable<TSource3 & TSource2_1 & TSource1_1 & TObject_2>; <TObject_3, TSource1_2, TSource2_2, TSource3_1, TSource4>(object: TObject_3, source1: TSource1_2, source2: TSource2_2, source3: TSource3_1, source4: TSource4): NonNullable<TSource4 & TSource3_1 & TSource2_2 & TSource1_2 & TObject_3>; <TObject_4>(object: TObject_4): NonNullable<TObject_4>; (object: any, ...sources: any[]): any; }; static zip: { <T1, T2>(arrays1: _.List<T1>, arrays2: _.List<T2>): [T1 | undefined, T2 | undefined][]; <T1_1, T2_1, T3>(arrays1: _.List<T1_1>, arrays2: _.List<T2_1>, arrays3: _.List<T3>): [T1_1 | undefined, T2_1 | undefined, T3 | undefined][]; <T1_2, T2_2, T3_1, T4>(arrays1: _.List<T1_2>, arrays2: _.List<T2_2>, arrays3: _.List<T3_1>, arrays4: _.List<T4>): [T1_2 | undefined, T2_2 | undefined, T3_1 | undefined, T4 | undefined][]; <T1_3, T2_3, T3_2, T4_1, T5>(arrays1: _.List<T1_3>, arrays2: _.List<T2_3>, arrays3: _.List<T3_2>, arrays4: _.List<T4_1>, arrays5: _.List<T5>): [T1_3 | undefined, T2_3 | undefined, T3_2 | undefined, T4_1 | undefined, T5 | undefined][]; <T>(...arrays: (_.List<T> | null | undefined)[]): (T | undefined)[][]; }; static kebabCase: (string?: string | undefined) => string; static xor: <T>(...arrays: (_.List<T> | null | undefined)[]) => T[]; static snakeCase: (string?: string | undefined) => string; static sortedUniq: <T>(array: _.List<T> | null | undefined) => T[]; static cloneDeep: <T>(value: T) => T; static cloneDeepWith: { <T>(value: T, customizer: _.CloneDeepWithCustomizer<T>): any; <T_1>(value: T_1): T_1; }; static cloneWith: { <T, TResult extends string | number | boolean | object | null>(value: T, customizer: _.CloneWithCustomizer<T, TResult>): TResult; <T_1, TResult_1>(value: T_1, customizer: _.CloneWithCustomizer<T_1, TResult_1 | undefined>): T_1 | TResult_1; <T_2>(value: T_2): T_2; }; }