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
Classes
| Name | Description |
|---|---|
PropertyPathParser | Parses a property path string (e.g. $.a.b[0]) into an array of property names and array indices. |
Functions
| Name | Description |
|---|---|
copyProperties | Copies specified properties from a source object to a destination object. |
deepMerge | Recursively merges two objects into a new object. |
getPropertyByPath | Extracts the value at a given property path from an 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. |
pickProperties | Creates a new object with only the specified properties. |