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

dollars

v0.0.9

Published

write less, do more, save dollars

Readme

Dollars

write less, do more, save dollars - This is the utility library for Node.js and often praised the jQuery of Node.js (just kidding, I made that up). It contains all the bat-shit-crazy utilities that I ship and create between different projects.

Installation

This module is only meant for Node.js usage or high-end browsers. It's released in the public npm registry and can be installed using:

npm install --save dollars

Usage

In all examples we assume that the library is required as followed:

'use strict';

var dollars = require('dollars');

Or if you require more swag in your application you can require it as following:

var $$$$$$$$$$$$$$$$$$$ = require('dollars');

Table of Contents

Object

The dollars.object contains all object specific utility methods. We do try to provide API parity with the Array methods. The object is also aliased as dollars.obj for shorter notation.

The following methods are available:

dollars.object.clone

Create a shallow clone of the given object. So only the first level properties are copied on to a new clean object.

var obj = dollars.object.clone({ foo: 'bar' });

dollars.object.map

Map the values of the object in to something completely different. It returns a new object with new values. This method requires 2 arguments:

  1. Object Object who's values need to be mapped.
  2. Function Mapping function which is called for every property in the object. The function receives the value as first argument and the key as second argument.
var obj = dollars.object.map({ foo: 'bar' }, function (value, key) {
  return value.toUpperCase();
});

// Results in: { foo: 'BAR' }

dollars.object.each

Execute the supplied callback for each key/value in the given object. The method requires 2 arguments:

  1. Object Object who's values need to be mapped.
  2. Function Iteration function which is called for every property in the object. The function receives the value as first argument and the key as second argument.
dollars.object.each({ foo: 'bar', bar: 'foo' }, function each(value, key) {
  console.log(key +':'+ value);
});

// Results in: foo:bar, bar:foo

dollars.object.breaks

A breakable iteration variant of dollars.object.each. In order to break out the iteration you need to return false. Just like the each method we accept the following arguments:

  1. Object Object who's values need to be mapped.
  2. Function Iteration function which is called for every property in the object. The function receives the value as first argument and the key as second argument.
dollars.object.breaks({ foo: 'bar', bar: 'foo' }, function (value, key) {
  console.log(key +':'+ value);
  return false;
});

// Results in: foo:bar -- As the iteration is broken after the first.

dollars.object.concat

Concatenate multiple objects to one single uber object. All supplied objects will be merged in to the first supplied object. There is no limit to the amount of objects that can be merged in to one.

dollars.object.concat({ foo: 'bar' }, { bar: 'foo' }, { hello: 'world' });A

// Results in: { foo: 'bar', bar: 'foo', hello: 'world' }

Array

Function

License

MIT