MCPcopy Create free account
hub / github.com/CodebuffAI/codebuff / removeUndefinedProps

Function removeUndefinedProps

common/src/util/object.ts:7–20  ·  view source on GitHub ↗
(
  obj: T,
)

Source from the content-addressed store, hash-verified

5}
6
7export const removeUndefinedProps = <T extends object>(
8 obj: T,
9): RemoveUndefined<T> => {
10 const newObj: Record<string, unknown> = {}
11
12 for (const key of Object.keys(obj)) {
13 const value = obj[key as keyof T]
14 if (value !== undefined) {
15 newObj[key] = value
16 }
17 }
18
19 return newObj as RemoveUndefined<T>
20}
21
22export const removeNullOrUndefinedProps = <T extends object>(
23 obj: T,

Callers 2

inputSchemaToJSONSchemaFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected