Skip to content

Namespace Object

Object utilities for copying, merging, inspecting, and type-checking JavaScript/TypeScript objects.

Install

Use this namespace only:

bash
npm i @litert/utils-object

Or install the full bundle:

bash
npm i @litert/utils

And then import from it.

ts
import * as LibUtils from '@litert/utils';
LibUtils.Object.deepMerge(a, b);

// or
import { Object as LibObject } from '@litert/utils';
LibObject.deepMerge(a, b);

Exports

Functions

NameDescription
copyPropertiesCopies specified properties from a source object to a destination object.
deepMergeRecursively merges two objects into a new object.
getConstructorReturns the constructor function of an object.
getPropertyNamesReturns all own property names and symbols of an object.
hasPropertiesChecks whether all specified properties exist on an object.
isClassConstructorChecks whether a value is a native ES2015 class constructor.
isSubclassOfChecks whether a class is a subclass of another.

Sub-path Exports

These are only accessible via their sub-path; they are not included in the main entry point.

NameImport PathDescription
pickProperties@litert/utils-object/functions/PickPropertiesCreates a new object with only the specified properties.

Typings

NameDescription
IMergeArray<T1, T2>Recursive merge result type for arrays.
IMergeObject<T1, T2>Recursive merge result type for objects.
IDeepMergeOptionsOptions for the deepMerge function.