/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
const resolveNestedKey = <T = any>(
  object: any,
  path: string,
  defaultValue: any,
): T => path.split(".").reduce((o, p) => (o ? o[p] : defaultValue), object);

export default resolveNestedKey;
