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

@baltimorecounty/javascript-utilities

v1.0.7

Published

JavaScript utilities.

Downloads

38

Readme

Baltimore County Javascript Utilities

A group of javascript utilities that have been found to be useful across different projects at Baltimore County.

Config Utilities

The config utilities help us share configuration values based on the cms environment they are in. Our current cms makes it extremely difficult to manage our config values in our apps.

import

import { Config } from "@baltimorecounty/javascript-utilities";
import {
  setConfig,
  getValue,
  config
} = Config;

setConfig

The constructor takes one parameter, "values", which is an object which contains configuration for the following environments: local, development, staging, production;

This utility will determine which environment is being used based on the contents of the browser URL per the following:

  • local - any url that contains localhost
  • development - any url with dev subdomain - Example: dev.baltimorecountymd.gov
  • staging - any url with staging subdomain - Example: staging.baltimorecountymd.gov
  • production - any url with www. or no subdomain but not localhost - Example: www.baltimorecountymd.gov

Usage

import { Config } from "@baltimorecounty/javascript-utilities";
const { setConfig } = Config;

const configValues = {
  local: {
    apiRoot: "http://localhost:1919/api",
    title: "Local - My Awesome App"
  },
  development: {
    apiRoot: "http://testservices.baltimorecountymd.gov/api",
    title: "Development - My Awesome App"
  },
  staging: {
    apiRoot: "http://stagingservices.baltimorecountymd.gov/api",
    title: "Staging - My Awesome App"
  },
  production: {
    apiRoot: "http://services.baltimorecountymd.gov/api",
    title: "My Awesome App"
  }
};

setConfig(configValues); // Sets the config for use with either GetValue or Config

Note: You will want to include this either at the beginning of your script inclusions or your app.js in a React app.

getValue

This function takes a parameter of the key of the configuration value you wish to return, e.g. "title".

You will get an error in the console describing what went wrong if the config hasn't been set, you are in an environment that doesn't exist, or you pass in a key that doesn't exist.

Usage

import { Config } from "@baltimorecounty/javascript-utilities";
const { getValue } = Config;
const apiRoot = getValue("title"); // for local environments returns "Local - My Awesome App" if used with the config object from the above example

config

Returns the entire config object

Usage

import { Config } from "@baltimorecounty/javascript-utilities";
const { config } = Config;
const apiRoot = console.log(config);
// The console log will output the below representation of the config object:
{
	local: {
		apiRoot: 'http://localhost:1919/api',
		title: 'Local - My Awesome App'
	},
	development: {
		apiRoot: 'http://testservices.baltimorecountymd.gov/api',
		title: 'Development - My Awesome App'
	},
	staging: {
		apiRoot: 'http://stagingservices.baltimorecountymd.gov/api',
		title: 'Staging - My Awesome App'
	},
	production: {
		apiRoot: 'http://services.baltimorecountymd.gov/api',
		title: 'My Awesome App'
	}
}

Url Utilities

The config utilities help us deal with the url when we need to

GetParameterByName

This function takes a parameter of the query parameter name of the configuration value you wish to return, e.g. "name". This function uses the current url, specifically the location.search property to work it's magic.

Usage

Example Url: http://abc.com?name=bob&age=20

To get Bob's age you would do the following

import { Urls } from "@baltimorecounty/javascript-utilities";
const { GetParameterByName } = Urls;

const bobsAge = GetParameterByName("age"); // returns "20"