npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

obj-path-attic

v0.0.2

Published

Utility package for handling deeply nested object paths.

Readme

obj-path-attic

obj-path-attic is a work-in-progress utility for handling deeply nested object paths in JavaScript and TypeScript. It currently supports setting values on objects using a combination of dot and bracket notation. This library aims to provide a flexible and type-safe alternative to existing packages like object-path.

⚠️ This library is not production-ready yet. Use at your own risk.

Features

  • Set nested properties: Add or update deeply nested properties in objects with dot and bracket notation.

  • Flexible handling of object and array paths: Supports mixed dot and bracket notation for accessing arrays and objects.

Installation

npm install obj-path-attic
yarn add obj-path-attic
pnpm add obj-path-attic

Current API

setOnPath

setOnPath(obj: Obj, path: string, value: unknown): void

Sets a value in a nested object, creating intermediate objects or arrays as needed.

import { setOnPath } from "obj-path-attic";

const obj = {};
setOnPath(obj, "nested[0].key", "value");
console.log(obj);
// Output: { nested: [{ key: "value" }] }

Known Issues

1. Setting values via array notation on objects

If a property is accessed with array notation ([]) but already exists as an object, the value will be added as a key instead of modifying the array.

Example:

const obj = { nested: { foo: "bar" } };
setOnPath(obj, "nested[1]", "test");
console.log(obj);
// Output: { nested: { foo: "bar", 1: "test" } }

2. Setting values via object notation on arrays

Conversely, attempting to set an object property on an existing array will throw an error.

Solutions in the future

TypeScript template literal types may be used to address these issues in the future.

Planned Features

  • Get: Retrieve values from objects using the same flexible path notation.
  • Delete: Remove properties from nested objects or arrays.
  • Empty: Clear specific nested paths.

Comparison with object-path

Unlike object-path, this library:

  • Supports mixed dot and bracket notation.
  • Allows explicit handling of numeric keys for objects or arrays.

Example:

import { setOnPath } from "obj-path-attic";

const obj = {};
setOnPath(obj, "foo.42[0]", "bar");
console.log(obj);
// Output: { foo: { 42: ["bar"] } }

object-path would treat 42 as an array index as it only uses the dot notation. This way numerical keys for arrays are not supported.

License

MIT © @jan-eckerlein