ObjectAPI Reference
API Reference
Complete API documentation for @visulima/object
Last updated:
API Reference
Property Access
getProperty
function getProperty<T>(
object: Record<string, unknown>,
path: string,
defaultValue?: T
): T | undefinedGet a nested property value using dot notation.
Parameters:
object- The source objectpath- Dot notation path (e.g., "user.profile.name")defaultValue- Value to return if property doesn't exist
Returns: Property value or default value
setProperty
function setProperty(
object: Record<string, unknown>,
path: string,
value: unknown
): voidSet a nested property value using dot notation.
deleteProperty
function deleteProperty(
object: Record<string, unknown>,
path: string
): booleanDelete a nested property using dot notation.
Returns: true if property was deleted
hasProperty
function hasProperty(
object: Record<string, unknown>,
path: string
): booleanCheck if a nested property exists.
escapePath
function escapePath(path: string): stringEscape special characters in a property path.
Object Filtering
pick
function pick<T extends Record<string, unknown>>(
object: T,
paths: string[]
): Partial<T>Create a new object with only specified properties.
Parameters:
object- Source objectpaths- Array of property paths to keep
Example:
pick({ a: 1, b: 2, c: 3 }, ["a", "c"])
// { a: 1, c: 3 }omit
function omit<T extends Record<string, unknown>>(
object: T,
paths: string[]
): Partial<T>Create a new object without specified properties.
Deep Operations
deepKeys
function deepKeys(object: Record<string, unknown>): string[]Extract all nested keys from an object.
deepKeysFromList
function deepKeysFromList(list: Array<Record<string, unknown>>): string[]Extract all possible keys from an array of objects.
Type Checking
isPlainObject
function isPlainObject(value: unknown): value is Record<string, unknown>Check if a value is a plain object.
Returns: true if value is a plain object
Function Summary
| Function | Category | Description |
|---|---|---|
getProperty | Access | Get nested property value |
setProperty | Access | Set nested property value |
deleteProperty | Access | Delete nested property |
hasProperty | Access | Check if property exists |
escapePath | Access | Escape special characters |
pick | Filtering | Keep specified properties |
omit | Filtering | Remove specified properties |
deepKeys | Deep Ops | Extract all nested keys |
deepKeysFromList | Deep Ops | Extract keys from array |
isPlainObject | Type Check | Check if plain object |
Next Steps
Usage Guide
Learn how to use these functions
Back to Overview
Return to package overview