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

@theoryofnekomata/number-name

v0.9.1

Published

Converts a number into its name.

Downloads

5

Readme

number-name

Converts a number into its name.

Why?

Inspired by number-to-words. Thinking I could improve on the code to include big integers, I looked for some info and found Landon Curt Noll's Web page describing the reconstructed English naming system of numbers. I decided to port his Perl script into JavaScript.

Installation

number-name requires Node.js, tested with at least v.5. It should work with relatively earlier versions of Node.js (at least v.4). If you find bugs from v.4, kindly create an issue specifying whatever error message you are getting, and the code snippet of your code using number-name (or you may submit PRs of your fixes, see Contribution below).

The procedures for installing number-name are:

  1. Install via NPM:
$ npm install --save @theoryofnekomata/number-name
  1. Run npm install
  2. Run npm run build

Usage

var NumberName = require('@theoryofnekomata/number-name'),

// see https://github.com/Temoto-kun/number-name/tree/master/src/lang for systems
converter = new NumberName({ system: systemObj, fractionType: 'lazy' });

var smallerNumber = -6.9e-42; // Number is OK. Can convert negative numbers just fine.
var largeNumber = '5.0e+303'; // note this is too large for a normal Number, so it is represented as string
var name1 = numberName(smallerNumber); // returns the long fractional name with "...six nine" in the end
var name2 = numberName(largeNumber); // returns "five centillion"

It also works in the browser via <script> tags.

Notes

number-name is powered by big-integer. With this, it can convert:

  • Numbers
  • number-like strings

TODO

  • [ ] Fully localizable number systems (e.g. custom rules for combining fragments of number words)
  • [ ] Optimizations for fractions.
  • [ ] Implement other fractionTypes, (only lazy (digits) is supported as of 0.2.0, e.g. 0.05 => zero point zero five, will implement ratio (zero and five over one hundred) and part (zero and five hundredths))
  • [ ] Upon adding more features, update the unit tests as well.

Contribution

Sure thing! Just clone the repo.

number-name uses Jasmine for unit tests, and ESLint to make sure code is written consistently (and implied it will run consistently as well).

  • Run npm install upon initial clone.
  • Run npm test and make sure all the tests pass and properly written.
  • Run npm run lint to ensure consistency of your code (make sure to install ESLint first).
  • Create PRs so that I can confirm and merge your contributions.

Please star the repo if you find it useful in your projects.

License

MIT. See LICENSE file for details.