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

unify-config

v0.6.5

Published

Unify config from `package.json`, `.env` file, environment variables and argv

Readme

Build Status Coverage Status

unify-config

Unify config from package.json (both caller modules and project root), .env files, environment variables and CLI arguments.

Install

npm install unify-config

APi

config([options])

config() will pick your config from the config field on your package.json file, your environment variables and your CLI arguments, and you can also set a parsers option to parse .env files and what extensions they should be used for each one. You can also define aliases, for example to map environment variables to your app arguments. Your config will return parsed as Javascript objects by using string2js module.

  • aliases: object mapping from source attribute names to destination ones. Destination can be a function too to calc the value to be used, if return an object then it will map its attributes recursively.
  • argv: array where to fetch the CLI arguments. If not defined, it will fetch them from process.argv.slice(2)
  • env: object holding environment variables. Default: process.env
  • parsers: array for dotenv files. Each one is an array, being first index a parser function and the other ones the file extensions. Any function that accept a string as only argument and return an object like JSON.parse() can be used as parser. It can also be set directly as the parsers value or to the parser array entry, and will be used for no extension files. Default: JSON.parse() using files with .json extension.
  • path: path of the dotenv files or directory holding them
const unifyConfig = require('unify-config')

const {parse: dotenv} = require('dotenv')
const {parse: ini}    = require('ini')
const json5           = require('json5/lib/parse')
const {load: yaml}    = require('js-yaml/lib/js-yaml/loader')
const {parse: toml}   = require('toml')

const config = unifyConfig({
  aliases: {
    GITHUB_REPOSITORY: function(value)
    {
      const [user, repo] = value.split('/')

      return {repo, user}
    },
    GITHUB_TOKEN: 'auth'
  },
  parsers: [
    [dotenv, ''],  // `dotenv` don't have an extension
    [ini   , '.ini'],
    [json5 , '.json', '.json5'],
    [toml  , '.toml'],
    [yaml  , '.yaml', '.yml']
  ]
})

config.bindEnv([options])

Like config(), but also sets the parsed values to the provided env object (or process.env if none is provided). Options are the same of config().

Known .env files parsers