Namespace Object
Object utilities for copying, merging, inspecting, and type-checking JavaScript/TypeScript objects.
Install
Use this namespace only:
bash
npm i @litert/utils-objectOr install the full bundle:
bash
npm i @litert/utilsAnd 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
| Name | Description |
|---|---|
copyProperties | Copies specified properties from a source object to a destination object. |
deepMerge | Recursively merges two objects into a new object. |
getConstructor | Returns the constructor function of an object. |
getPropertyNames | Returns all own property names and symbols of an object. |
hasProperties | Checks whether all specified properties exist on an object. |
isClassConstructor | Checks whether a value is a native ES2015 class constructor. |
isSubclassOf | Checks 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.
| Name | Import Path | Description |
|---|---|---|
pickProperties | @litert/utils-object/functions/PickProperties | Creates a new object with only the specified properties. |
Typings
| Name | Description |
|---|---|
IMergeArray<T1, T2> | Recursive merge result type for arrays. |
IMergeObject<T1, T2> | Recursive merge result type for objects. |
IDeepMergeOptions | Options for the deepMerge function. |