{"version":3,"file":"index.mjs","sources":[""],"sourcesContent":["export type TGetObjWithoutUndefinedArgs = Parameters<typeof getObjWithoutUndefined>;\n\nexport type TGetObjWithoutUndefinedReturn = ReturnType<typeof getObjWithoutUndefined>;\n\ntype TObjectWithoutUndefined<T extends object> = {\n  [TKey in keyof T as T[TKey] extends undefined ? never : TKey]: Exclude<T[TKey], undefined>;\n};\n\n/**\n * Creates a shallow copy without own properties whose value is `undefined`.\n * @template T\n * @param {T} obj Source object\n * @returns {TObjectWithoutUndefined<T>} Object with defined values\n * @throws {TypeError} getObjWithoutUndefined: obj must be a plain object\n * @example\n * getObjWithoutUndefined({ id: 1, name: undefined }); // { id: 1 }\n * @example\n * // Build a PATCH payload while preserving intentional null values\n * const payload = getObjWithoutUndefined({ name, avatar: null, phone: undefined });\n * // `phone` is removed, while `avatar` remains null\n */\nexport const getObjWithoutUndefined = <T extends object>(obj: T): TObjectWithoutUndefined<T> => {\n  if (!obj || typeof obj !== \"object\" || Array.isArray(obj)) {\n    throw new TypeError(\"getObjWithoutUndefined: obj must be a plain object\");\n  }\n\n  const result = {} as TObjectWithoutUndefined<T>;\n  Reflect.ownKeys(obj).forEach((key) => {\n    const value = (obj as Record<PropertyKey, unknown>)[key];\n    if (value !== undefined) {\n      (result as Record<PropertyKey, unknown>)[key] = value;\n    }\n  });\n  return result;\n};\n"],"names":["getObjWithoutUndefined","obj","Array","isArray","TypeError","result","Reflect","ownKeys","forEach","key","value","undefined"],"mappings":"AAqBO,MAAMA,uBAA4CC,MACvD,IAAKA,YAAcA,MAAQ,UAAYC,MAAMC,QAAQF,KACnD,MAAM,IAAIG,UAAU,sDAGtB,MAAMC,OAAS,CAAA,EACfC,QAAQC,QAAQN,KAAKO,QAASC,MAC5B,MAAMC,MAAST,IAAqCQ,KACpD,GAAIC,aAAUC,EACXN,OAAwCI,KAAOC,QAGpD,OAAOL"}