Umpteen is a little npm module to help you spell out numbers in words.
Umpteen currently handles numbers up to 16 digits long.
Why not? Also: words > numbers.
Run tests with mocha. Tests are in the /test directory.
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.
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
To test this module on the command line, try this:
npm install umpteen
#!/usr/bin/env nodevar spellIt = ;var input = processargv2;console;
node spellItOut 77
Umpteen has no runtime dependencies. To run the tests, you'll need:
For checking test coverage and getting that nice little badge at the top, I used:
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.
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.