Skip to content

object-utils

Contains utility functions for Objects.

Interface Description
SetNestedPropertyValueParams Parameters for setNestedPropertyValue.
ToJsonOptions Options for toJson.
Function Description
assignWithNonEnumerableProperties Assigns properties from one or more source objects to a target object, including non-enumerable properties.
castTo Casts a value to a specific type.
cloneWithNonEnumerableProperties Clones an object, including non-enumerable properties.
deleteProperties Deletes multiple properties from an object.
deleteProperty Deletes a property from an object.
extractDefaultExportInterop Extracts the default export from a module. Useful to handle incorrect default export interop between ESM and CJS.
getAllEntries Gets all entries of an object.
getAllKeys Gets all keys of an object. Includes fields and properties.
getNestedPropertyValue Gets the value of a nested property from an object.
getPrototypeOf Gets the prototype of the specified object.
isDeepEqual Compares two values to determine if they are deeply equal.
nameof Retrieves the name of a property of a given type T.
normalizeOptionalProperties Normalizes optional properties to allow undefined assignment in strict mode. This utility provides a workaround for the exactOptionalPropertyTypes TypeScript flag, which prohibits directly assigning undefined to optional properties when the type explicitly omits undefined. Example: typescript // With `exactOptionalPropertyTypes: true` const x: \{ prop?: string \} = \{ prop: undefined \}; // Compiler error // Using this utility: const y: \{ prop?: string \} = normalizeOptionalProperties<\{ prop?: string \}>(\{ prop: undefined \}); // Works
removeUndefinedProperties Removes all undefined properties from an object.
setNestedPropertyValue Sets the value of a nested property in an object.
toJson Converts a given value to a JSON string.
Enum Description
FunctionHandlingMode Specifies how functions should be handled in the JSON output.