@ts-utilkit/object
v0.2.0
Published
Object manipulation utilities for deep merging, cloning, path access, and transformation
Maintainers
Readme
@ts-utilkit/object
object Functions - TypeScript utility functions for object operations.
Installation
npm install @ts-utilkit/objectFeatures
- 🚀 TypeScript-first with complete type definitions
- ✅ Comprehensive test coverage (>95%)
- 📦 Tree-shakeable ESM and CommonJS support
- 🔒 Type-safe with strict TypeScript configuration
- 📖 Extensive JSDoc documentation
Available Functions (39)
applyDefaults- Apply default values to objectcompactObject- Remove undefined/null valuescountProperties- Count object propertiesdeepClone- Deep clone objectsdeepCloneWith- Deep clone with custom handlerdeepEqual- Deep equality comparisondeepFreeze- Recursively freeze objectdeepMerge- Deep merge objectsdifferenceBy- Get object difference by keyentriesToObject- Convert entries to objectflattenObject- Flatten nested objectsflipObject- Swap keys and valuesfromDotNotation- Convert dot notation to nested objectgetDeepEqualityHash- Generate equality hashgetObjectDifference- Get difference between objectsgroupByObject- Group array into objecthasKey- Check if object has keyinvertObject- Invert object keys/valuesisDeepSubset- Check if object is subsetisObjectEmpty- Check if object is emptykeyBy- Convert array to object keyed by fieldkeysToCamelCase- Convert keys to camelCasekeysToSnakeCase- Convert keys to snake_caseobjectMap- Map object valuesobjectSize- Get number of propertiesobjectToQueryString- Convert object to query stringomitBy- Omit properties by predicateomitKeys- Omit specific keyspickBy- Pick properties by predicatepickKeys- Pick specific keysqueryStringToObject- Parse query string to objectremoveEmptyValues- Remove empty valuessafeGet- Safe property access with defaultsafeSet- Safe property settingsetNestedValue- Set nested property valueshallowEqual- Shallow equality comparisonsortObjectKeys- Sort object keys alphabeticallyunflattenObject- Unflatten dot notation objectuniqueValues- Get unique values from object
Quick Example
import {
deepMerge,
safeGet,
flattenObject,
pickProperties,
} from '@ts-utilkit/object';
deepMerge({ a: 1 }, { b: 2 }); // {a: 1, b: 2}
safeGet({ a: { b: 'c' } }, 'a.b'); // 'c'
flattenObject({ a: { b: { c: 1 } } }); // {'a.b.c': 1}
pickProperties(obj, ['id', 'name']); // {id: 1, name: 'Alice'}License
MIT © Mykyta Forofontov
Contributing
Contributions are welcome! Please see the main repository for contribution guidelines.
