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

cap-helpers

v1.0.2

Published

Helper functions for CAP Distributing

Readme

CAP Distributing's JavaScript Helpers

Circle CI Badge codecov NSP Status David Status David Dev Status NPM Version MIT License

We created this package so we could easily share these basic function across all of our applications.

Usage

It returns the following functions:

  • sortArray: a function that takes 2 parameters (Array to sort, and key to sort on) and returns a sorted array. For example:
    • var capHelpers = require('cap-helpers');
      var myArray = [{name: 'Zach'}, {name: 'Jamie'}];
      capHelpers.sortArray(myArray, ['name']);
      // returns [{name: 'Jamie'}, {name: 'Zach'}]
  • toBase64: a function that converts the given value to base64. For example:
    • var capHelpers = require('cap-helpers');
      var value = 'this is a string!!';
      capHelpers.toBase64(value);
      // returns 'dGhpcyBpcyBhIHN0cmluZyEh'
  • fromBase64: a function that converts the given value from base64. For example:
    • var capHelpers = require('cap-helpers');
      var value = 'dGhpcyBpcyBhIHN0cmluZyEh';
      capHelpers.fromBase64(value);
      // returns 'this is a string!!'
  • orderObject: a function that orders an object's keys alphabetically. For example:
    • var capHelpers = require('cap-helpers');
      var myObj = {name: 'Jamie', age: 25};
      capHelpers.orderObject(myObj);
      // returns {age: 25, name: 'Jamie'}
  • numberWithCommas: a function that converts a number to a string with commas. For example:
    • var capHelpers = require('cap-helpers');
      var num = 1234567.89;
      capHelpers.numberWithCommas(num);
      // returns '1,234,567.89'
  • camelcaseToUnderscore: a function that takes a camelcased string, object or array and converts it to underscores. For example:
    • var capHelpers = require('cap-helpers');
      var str = 'myString';
      capHelpers.camelcaseToUnderscore(str);
      // returns 'my_string'
  • underscoreToCamelcase: a function that takes an underscored string, object or array and converts it to camelcase. For example:
    • var capHelpers = require('cap-helpers');
      var str = 'my_string';
      capHelpers.underscoreToCamelcase(str);
      // returns 'myString'
  • underscoreToTitlecase: a function that takes an underscored string, object or array and converts it to titlecase. For example:
    • var capHelpers = require('cap-helpers');
      var str = 'my_string';
      capHelpers.underscoreToTitlecase(str);
      // returns 'MyString'
  • titlecaseToCamelcase: a function that takes a titlecased string, object or array and converts it to camelcase. For example:
    • var capHelpers = require('cap-helpers');
      var str = 'MyString';
      capHelpers.titlecaseToCamelcase(str);
      // returns 'myString'

Testing

  • npm test > Runs all the tests and checks the code coverage.
  • npm run single-test > Runs all the tests once.
  • npm run watch-test > Runs all the tests and watches for changes.
  • npm run check-coverage > Checks the code coverage (this should be ran after running the tests).