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

@mrlm/cfg

v0.3.2

Published

Typescript hierarchical configuration package, it's doing nothing more than working with objects and merge them deeply without any additional dependencies.

Readme

mrlm-net/cfg

Typescript hierarchical configuration package, it's doing nothing more than working with objects and merge them deeply without any additional dependencies.

| Package | mrlm-net/cfg | | :-- | :-- | | NPM name | @mrlm/cfg | | NPM version | NPM Version | | Latest version | GitHub Release | | License | GitHub License |

Table of contents

Installation

I'm using YARN so examples will be using it, you can install this package via any Node Package Manager.

$ yarn add @mrlm/cfg

Usage

Import the package and use it to merge configuration objects deeply.

import { Config } from "@mrlm/cfg";

const defaultConfig = {
  database: {
    host: "localhost",
    port: 5432,
  },
  server: {
    port: 3000,
  },
};

const environmentConfig = {
  database: {
    host: "production-db.example.com",
  },
  server: {
    port: 8000,
  },
};

const instance = new Config(defaultConfig, environmentConfig);

console.log(instance);
// Config instance:
// class Config implements IConfig {
//   private config: {    
//     database: {
//       host: "production-db.example.com",
//       port: 5432,
//     },
//     server: {
//       port: 8000,
//     },
//   }
// }

// GET value without fallback
console.log(instance.get("database.host")); 
// Output: "production-db.example.com"
// GET value with fallback
console.log(instance.get("database.unknown", "fallback")); 
// Output: "fallback"

Advanced Usage

We have specific handlers for Node.js based environments to allow you easily manage environment variables mapping and also filesystem based configurations. Those functions are exported as part of @mrlm/cfg/server package and can be used as follows. Also all components are exported as separated subpackage to allow you to not pollute application bundle with unnecessary code.

Deepmerge function

We have created our own naive implementation of deepmerge function, you can also use this package to achieve deep merge in your other apps.

import { deepmerge } from "@mrlm/cfg/deepmerge";

const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { b: { d: 3 } };

const merged = deepmerge(obj1, obj2);
console.log(merged); // Output: { a: 1, b: { c: 2, d: 3 } }

Environment function

You can map environment variables to your configuration using the environment function. It accepts the prefix to be stripped and optional level separator.

# .env file contents
PREFIX_DATABASE_HOST="env-db-host"
PREFIX_DATABASE_PORT="env-db-port"
PREFIX_SERVER_PORT="env-server-port"
import { environment } from "@mrlm/cfg/environment";

const envConfig = environment("PREFIX_", "_");

console.log(envConfig);
// Output will depend on your environment variables, e.g.:
// {
//   database: {
//     host: "env-db-host",
//     port: "env-db-port",
//   },
//   server: {
//     port: "env-server-port",
//   },
// }

Load function

You can load configuration from files using the file and files functions.

import { file, files } from "@mrlm/cfg/file";

const single = file("config/default.json"), 

const multiple = files([
  "config/default.json", 
  "config/production.json"
]);

console.log(single, multiple);
// Output will depend on the contents of your configuration files.

Export Paths

The following export paths are available based on the package.json:

  • @mrlm/cfg for the main package
  • @mrlm/cfg/environment for the environment function
  • @mrlm/cfg/deepmerge for the deepmerge function
  • @mrlm/cfg/file for the load file(s) function
  • @mrlm/cfg/server for the server-specific functions

Contributing

Contributions are welcomed and must follow Code of Conduct and common Contributions guidelines.

If you'd like to report security issue please follow security guidelines.


All rights reserved © Martin Hrášek <@marley-ma> and WANTED.solutions s.r.o. <@wanted-solutions>