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 🙏

© 2024 – Pkg Stats / Ryan Hefner

umpteen

v0.1.1

Published

A helper for spelling out numbers in words.

Downloads

7

Readme

Build Status Coverage Status

What's Umpteen?

Umpteen is a little npm module to help you spell out numbers in words.

  • 99 = ninety-nine
  • 99.99 = ninety-nine (umpteen discards anything after the decimal point)
  • 108 = one hundred and eight
  • 89,828,374,987 = eighty-nine billion, eight hundred and twenty-eight million, three hundred and seventy-four thousand, nine hundred and eighty-seven
  • 9,999,999,999,999,999 = nine quadrillion, nine hundred and ninety-nine trillion, nine hundred and ninety-nine billion, nine hundred and ninety-nine million, nine hundred and ninety-nine thousand, nine hundred and ninety-nine

Assumptions

Umpteen expects string input but will try to deal with number input as well, up to but not including 9007199254740992, which is the biggest number Javascript will nicely turn into a string.

Umpteen currently handles numbers up to 16 digits long.

Why Umpteen?

Why not? Also: words > numbers.

Using Umpteen

Testing

Run tests with mocha. Tests are in the /test directory.

mocha /test/test.js

or

npm test

A Note on Formatting

Umpteen handles numbers written in US-style notation: 6,543.21. (Except that it throws away everything after the decimal point.) If you'd like to use Euro-style numbers, you can fork this & look for the comments, I've marked where the "." delimiter is shown (//HEY DELIMITERS HERE). Please feel free to send me a pull request if you can figure out how to handle both instances nicely.

A Note on Names for Numbers

Umpteen uses the "short scale" for deciding when to start using the term "billion" (i.e., a billion is a thousand millions). More info here: http://en.wikipedia.org/wiki/Long_and_short_scales

Command-Line?

To test this module on the command line, try this:

  1. in a new directory,
npm install umpteen 
  1. Create a spellItOut.js file with these lines:
#!/usr/bin/env node
var spellIt = require('umpteen');
var input = process.argv[2];
console.log(spellIt.spellItOut(input));
  1. from the command line, type:
node spellItOut 77
  1. You should see this returned:
"seventy-seven"

Dependencies?

Umpteen has no runtime dependencies. To run the tests, you'll need:

  • mocha
  • should

For checking test coverage and getting that nice little badge at the top, I used:

  • istabul
  • coveralls

Thanks and acknowledgements

Umpteen was inspired by Landon Curt Noll's print-the-numbers perl script, which is way better and fuller-featured than this module. You should check it out: http://www.isthe.com/chongo/tech/math/number/number

If you don't like this implementation, or you need to spell out numbers in French or Danish, try this module by jmosbech (https://github.com/jmosbech): https://www.npmjs.org/package/spell-it

Thanks also to casualjim (https://github.com/casualjim) for helping me figure out how to see my test coverage.

License

Umpteen is made available under the MIT software license (http://opensource.org/licenses/MIT)

The MIT License (MIT)

Copyright (c) 2014 Erin McKean

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.