UNPKG

sly-utils

Version:

sly-utils is a modular and efficient JavaScript utility library designed to simplify complex tasks.

31 lines (30 loc) 690 B
/** * Utility method to flatten the nested object to a single level object * @param {object} Nested object * @returns {object} Returns a single level object * * @example * * Given input: * let input = { * "user": { * "name": "XYZ", * "createdDate": "123424", * "department": { * "id": "0123", * "type": "ABC" * } * } * } * * flattenObject(input); * * Expected output: * { * "userName": "XYZ", * "userCreatedDate": "123424", * "userDepartmentId": "0123", * "userDepartmentType": "ABC" * } */ export declare const flattenObject: (obj: Record<string, any>, parent?: string, res?: Record<string, any>) => Record<string, any>;