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

puppyrock

v0.0.1

Published

puppyrock is a small, no-fuss, dependency free library for managing and loading config files

Readme

PuppyRock Logo

PuppyRock is a lightweight, dependency-free, ES6 compliant JavaScript module to handle config files.

The focus of this module is to keep is lean and lightweight, while still being Just-Useful-Enough.

Usage

All you have to do is require and instantiate the config.

const Config = require('puppyrock')
const options = {
  defaultConf: {
    a: 2
  }
}
const config = new Config(options)
console.log(config.a) // 2

The Config class takes an options argument. See Options for valid properties.

Options

| Property | Type | note | |----------|-------|------| | defaultConf | Object | The default base config which userConf and environment variables is merged into | | userConf | String | Path to user defined config file | | envPrefix | String | Treat environment variables, prefixed with this string, as configuration parameters|

Example options

const options = {
  defaultConf: {
    a: 2
  },
  userConf: './config.conf',
  envPrefix: 'PUPPYROCK_'
}

Config inheritance

PuppyRock merges configs in the following order:

  1. defaultConf is copied into the final config
  2. userConf is then parsed and merged into the final config, overwritting any conflicts from defaultConf
  3. Environment variables are then consulted and any matching the envPrefix will be parsed and merged into the final config - Overwritting any clonficts from userConf and defaultConf

userConf format

The userConf options should point to a plain text file, separated by newlines. The config parameters in the config file is a set of key/value pairs seperated by an '='.

The right side of the '=' can either be a word, number or a comma separated list of words and/or commas. PuppyRock will cast the values the following way:

  • A word is cast as a String
  • A number is cast as a Number
  • A comma-separated value is cast as an Array

All other lines will be ignored, thus you can use # to denote comments

Example

#This is a comment
a=b
number=25
list=dog,cat,42

The above example will be parsed the following way:

  • a=b is parsed as {a: 'b'}
  • number=25 is parsed as {number: 25}
  • list=dog,cat,42 is parsed as {list: ['dog', 'cat', 42 ]}

Limitations

Deep nesting

You cannot create a list within a list. Thus list=listA=a1,a2,listB=b1,b2 is not supported and will not yield

{
  list: [
    { listA: [
      'a1',
      'a2'
      ]
    },
    { listB: [
      'b1',
      'b2'
      ]
    }
  ]
}

Numbers as strings

As any word resembling a non-float number is coerced into a number, it is not possible to create a String that contains, say, '42'

Objects are not supported

As you might be able to get from the userConf format section, only Strings, Numbers and Arrays are supported. Thus it is not possible to have an Object of key:values in the config (Well, you could have it in the defaultConf Object and not overwrite it. But for the sake of sanity, please don't)

FAQ

You state that is't dependency-free, when in reality it's not?

While PuppyRock has no production dependencies, it does have a few development dependencies. These are necesarry in order to provide unit- and integration-testing to ensure the code-quality of PuppyRock