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 | undefined

Get a nested property value using dot notation.

Parameters:

  • object - The source object
  • path - 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
): void

Set a nested property value using dot notation.


deleteProperty

function deleteProperty(
  object: Record<string, unknown>,
  path: string
): boolean

Delete a nested property using dot notation.

Returns: true if property was deleted


hasProperty

function hasProperty(
  object: Record<string, unknown>,
  path: string
): boolean

Check if a nested property exists.


escapePath

function escapePath(path: string): string

Escape 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 object
  • paths - 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

FunctionCategoryDescription
getPropertyAccessGet nested property value
setPropertyAccessSet nested property value
deletePropertyAccessDelete nested property
hasPropertyAccessCheck if property exists
escapePathAccessEscape special characters
pickFilteringKeep specified properties
omitFilteringRemove specified properties
deepKeysDeep OpsExtract all nested keys
deepKeysFromListDeep OpsExtract keys from array
isPlainObjectType CheckCheck if plain object

Next Steps

Usage Guide

Learn how to use these functions

Back to Overview

Return to package overview

Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues