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 🙏

© 2025 – Pkg Stats / Ryan Hefner

configent

v3.0.0

Published

Confident configurations

Readme

Configent

Confident configurations

No fuzz config compilation from (ordered by ascending precedence)

  • defaults
  • package.json
  • [name].config.js
  • .env
  • environment
  • input
/** 
 * package.json {"foobar": {"city": "Portsmouth"}}
 * foobar.config.js {lastSeen: 'Liverpool'}
 * process.env.foobar_last_seen = London
 * options = { name: 'Sherlock Holmes' }
*/

const defaults = { name: 'John Doe', city: 'N/A', lastSeen: 'N/A' }

const config = configent('foobar', defaults, options)

/**
 * console.log(config)
 * {
 *   name: 'Sherlock Holmes',
 *   city: 'Portsmouth',
 *   lastSeen: 'London'  
 * }
 * /

Auto detect defaults

Configent supports multiple default configs. These are added to ./configs.

/** ./configs/routify2.config.js */

module.exports = {
    supersedes: ['svelte'],
    condition: ({ pkgjson }) => pkgjson.dependencies['@roxi/routify'],
    config: () => ({ 
        /** the config object used as default */
        myAppName: 'Routify App' 
    })
}
/** ./configs/svelte.config.js */

module.exports = {
    condition: ({ pkgjson }) => pkgjson.dependencies['svelte'],
    config: () => ({ 
        /** the config object used as default */
        myAppName: 'Svelte App' 
    })
}

The first config with a true condition is used. To avoid conflicts, configs using the supersedes option, will run before their superseded targets.

To change the location of default configs, refer to detectDefaultsConfigPath.

API

Table of Contents

configent

Parameters
  • options object? configent options

    • options.defaults {} defaults. Used for type casting env variables (optional, default {})
    • options.name string name to use for configs. If left empty, name from package.json is used (optional, default '')
    • options.cacheConfig boolean calling configent twice with same parameters will return the same instance (optional, default true)
    • options.cacheDetectedDefaults boolean calling configent twice from the same module will return the same defaults (optional, default true)
    • options.useDotEnv boolean include config from .env files (optional, default true)
    • options.useEnv boolean include config from process.env (optional, default true)
    • options.usePackageConfig boolean include config from package.json (optional, default true)
    • options.useConfig boolean include config from [name].config.js (optional, default true)
    • options.useDetectDefaults boolean detect defaults from context (package.json and file stucture) (optional, default true)
    • options.detectDefaultsConfigPath string detect defaults from context (package.json and file stucture) (optional, default 'configs')
    • options.sanitizeEnvValue function sanitize environment values. Convert snake_case to camelCase by default. (optional, default str=>str.replace(/[-_][a-z]/g,str=>str.substr(1).toUpperCase()))
    • options.module NodeModule? required if multiple modules are using configent


Vintage vector created by macrovector - www.freepik.com