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

bill-counter-js

v0.0.6

Published

The bill counter effect is expressed in JavaScript.

Downloads

13

Readme

Description

The bill counter effect is expressed in JavaScript.

See API Docs for details.

Required

This library does not require any other libraries in production.

In development, we bundled with webpack.

Installation

Local

download

CDN

<script src="https://unpkg.com/[email protected]/dist/bill-counter.min.js"></script>

NPM

yarn add bill-counter-js

or

npm install bill-counter-js -S

How to use

NOTE

You must run the function after 'DOMContentLoaded' event.

Similar to jquery's $(document).ready().

DOMContentLoaded is a web standard and jQuery is not a web standard.

Browser

<script src="https://unpkg.com/[email protected]/dist/bill-counter.min.js"></script>

<script>
  document.addEventListener('DOMContentLoaded', () => {
    $B.countByN('selector-id', targetMoney, N, interval);
  });
</script>

see example source

ESM

import { $B } from 'https://unpkg.com/[email protected]/dist/bill-counter.esm.js';

document.addEventListener('DOMContentLoaded', () => {
  $B.countByN('selector-id', targetMoney, N, interval);
}

see example source

Common JS

const { $B } = require('bill-counter-js');

$B.countByN('selector-id', targetMoney, N, interval);

API Documents

1. Count by N

$B.countByN(id, end, n, (interval = 0.1));

Count the numbers by n.

Perhaps most similar to the counter.

2. Fast counting

$B.countFast(id, end, (duration = 100));

Count any number in a certain amount of time.

I think it will be very effective as an animation.

3. Count Object

The above two functions only worked for DOM objects. But sometimes you need to modify the Model, not the View, like Vue.js. Try using countObjectByN or countObjectFast.

It is basically the same except that the first argument is object.

Copy the code below and run node source.js!

const { $B } = require('bill-counter-js');
const obj = {
  value: 0,
};

$B.countObjectByN(obj, 1000, 1, (interval = 1));

function test() {
  return new Promise(resolve => {
    let i = 0;
    const sid = setInterval(() => {
      console.log(obj);
      i++;
      if (i === 1000) {
        clearInterval(sid);
        resolve();
      }
    }, 1);
  });
}

(async () => {
  await test();
})();

4. Locale Setting (Formatting)

// default
$B.localeOptions = {
  format: true,
  locale: 'en-US',
  currency: 'USD',
};
  • format: Do you format in currency? (true = yes)

  • locale: What language do you speak? (Learn More)

  • currency: What currency are you using? (Learn More)

5. Define your formatter

The default formatter uses the ECMAScript Internationalization API. (INTL) If you don't like this, define your own formatter.

$B.formatStyler = (number) => {
  // your formatter!
}

If you want to change back to the default style,

run $B.formatStyler = $B.defaultFormatStyler;

Library demo

Try the demo here.