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

config-dot-get

v1.0.1

Published

A simple JSON configuration reader with dot notation support

Readme

config-dot-get

config-dot-get is a lightweight JSON configuration reader that allows developers to retrieve and modify settings using dot notation. It efficiently handles nested configuration values.

🚀 Installation

npm install config-dot-get

📖 Usage

const ConfigReader = require("config-dot-get");

const config = new ConfigReader("config.json");

// Get a value using dot notation
console.log(config.get("transpile.debug", true)); // Returns the value or default (true)

// Set a value
config.set("logging.level", "info");
console.log(config.get("logging.level")); // "info"

✨ Features

  • Supports dot notation for accessing nested keys.
  • Allows modifying settings dynamically with .set().
  • Automatically saves changes to the JSON file.
  • Provides default values if a key is missing.

📌 Examples

🔹 Basic Usage

const ConfigDotGet = require("config-dot-get");

const config = new ConfigReader("config.json");

// Retrieve a top-level value
console.log(config.get("app.name")); // Example output: "MyApp"

// Retrieve a nested value using dot notation
console.log(config.get("database.host")); // Example output: "localhost"

// Provide a default value if the key is missing
console.log(config.get("server.port", 3000)); // Example output: 3000 (default)

🔹 Setting Values

// Modify a value dynamically
config.set("logging.level", "debug");

// Retrieve the updated value
console.log(config.get("logging.level")); // Example output: "debug"

🔹 Handling missing values

console.log(config.get("feature.enable", false)); // Returns default (false)

🔹 Working with Nested Configuration

// Config structure (config.json)
// {
//   "database": {
//     "host": "localhost",
//     "port": 5432
//   }
// }

// Access nested values
console.log(config.get("database.port")); // Example output: 5432

🏆 Best Practices

  1. Use default values: Always provide a default value when retrieving configuration settings to avoid unexpected undefined values.

    const port = config.get("server.port", 3000);
  2. Keep configuration organized: Structure JSON files logically to prevent deep nesting that may be difficult to maintain.

  3. Validate input: Ensure the retrieved values match expected data types to prevent runtime issues.

    const logLevel = config.get("logging.level", "info");
    if (typeof logLevel !== "string") {
     throw new Error("Invalid log level type");
    }
  4. Avoid hardcoding paths: Store key paths in constants for better maintainability.

    const SERVER_PORT = "server.port";
    const port = config.get(SERVER_PORT, 3000);
  5. Use .set() responsibly: Modify configuration settings only when necessary to prevent unintended overrides.

    config.set("feature.enabled", true);

🛠 License

This package is licensed under MIT License.