Installation & Quick Start

How to install @visulima/object and get started quickly

Last updated:

Installation & Quick Start

Installation

npm install @visulima/object
pnpm add @visulima/object
yarn add @visulima/object
bun add @visulima/object

Import

import {
  getProperty,
  setProperty,
  deleteProperty,
  hasProperty,
  pick,
  omit,
  deepKeys,
  isPlainObject
} from "@visulima/object";

Quick Start Examples

Access Nested Properties

import { getProperty, setProperty } from "@visulima/object";

const data = { user: { profile: { name: "Alice" } } };

// Get
const name = getProperty(data, "user.profile.name"); // "Alice"

// Set
setProperty(data, "user.profile.age", 30);

Filter Objects

import { pick, omit } from "@visulima/object";

const user = { id: 1, name: "Alice", password: "secret", email: "alice@example.com" };

// Keep only specific fields
const publicUser = pick(user, ["id", "name", "email"]);

// Remove sensitive fields
const safeUser = omit(user, ["password"]);

Check Property Existence

import { hasProperty } from "@visulima/object";

const config = { api: { key: "abc123" } };

if (hasProperty(config, "api.key")) {
  console.log("API key configured");
}

TypeScript Support

Full TypeScript support with type inference:

import { getProperty, pick } from "@visulima/object";

interface User {
  id: number;
  profile: {
    name: string;
    settings: {
      theme: "light" | "dark";
    };
  };
}

const user: User = { /* ... */ };

// Type-safe access
const theme = getProperty(user, "profile.settings.theme");
// Type: "light" | "dark"

// Type-safe filtering
const filtered = pick(user, ["id", "profile.name"]);

Next Steps

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