/* * @poppinss/utils * * (c) Poppinss * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ type PartialShallow = { [P in keyof T]?: T[P] extends object ? object : T[P] } type PropertyName = string | number | symbol type PropertyNames = PropertyName | ReadonlyArray type ValueKeyIterateeTypeGuard = (value: T, key: string) => value is S type IterateeShorthand = PropertyName | [PropertyName, any] | PartialShallow type ValueKeyIteratee = ((value: T, key: string) => NotVoid) | IterateeShorthand /** * Instead of using lodash as a dependency (which is around 4MB), we create a * customized build of lodash with only the following methods. * * I know that 4MB is not a huge deal on the server, but I am okay shoving that * off, if the work to maintain custom build is not too much. * * How about Lodash per methods packages? * They are out of date from the main lodash. That is the main problem */ declare module '@poppinss/utils/lodash' { type LodashMethods = { pick: (object: T | null | undefined, ...props: Array) => Partial pickBy( object: Record | null | undefined, predicate: ValueKeyIterateeTypeGuard ): Record /** * @see _.pickBy */ pickBy( object: Record | null | undefined, predicate: ValueKeyIterateeTypeGuard ): Record /** * @see _.pickBy */ pickBy( object: Record | null | undefined, predicate?: ValueKeyIteratee ): Record /** * @see _.pickBy */ pickBy( object: Record | null | undefined, predicate?: ValueKeyIteratee ): Record /** * @see _.pickBy */ pickBy( object: T | null | undefined, predicate?: ValueKeyIteratee ): PartialObject omit: ( object: T | null | undefined, ...paths: Array ) => Partial omitBy( object: Record | null | undefined, predicate?: ValueKeyIteratee ): Record /** * @see _.omitBy */ omitBy( object: Record | null | undefined, predicate?: ValueKeyIteratee ): Record /** * @see _.omitBy */ omitBy( object: T | null | undefined, predicate: ValueKeyIteratee ): PartialObject has: (object: T, path: PropertyNames) => boolean get: (object: any, path: PropertyNames, defaultValue?: any) => any set: (object: any, path: PropertyNames, value: any) => any unset: (object: any, path: PropertyNames) => boolean mergeWith: (object: any, ...otherArgs: any[]) => any merge: (object: any, ...otherArgs: any[]) => any size: (collection: object | string | null | undefined) => number clone: (value: T) => T cloneWith: ( value: T, customizer: ( value: any, key: number | string | undefined, object: T | undefined, stack: any ) => T | undefined ) => T cloneDeep: (value: T) => T cloneDeepWith: ( value: T, customizer: ( value: any, key: number | string | undefined, object: T | undefined, stack: any ) => T | undefined ) => T toPath: (value: any) => string[] } const lodash: LodashMethods export default lodash }