Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 1.16 KB

README.md

File metadata and controls

44 lines (30 loc) · 1.16 KB

SayThisNumber

Parses raw numbers into a human language.

Usage

import say from 'SayThisNumber';
say.thisNumber(37).in('english'); // => 'thirty seven'
say.thisNumber(52).in('russian'); // => пятьдесят два'

Ranges:

import say from 'SayThisNumber';
say.thisNumberRange(3,1).in('spanish'); // => [ 'tres', 'dos', 'uno' ]

Multiple numbers:

import say from 'SayThisNumber';
say.theseNumbers([33, 91]).in('icelandic') // => [ 'þrettán', 'níutíu og einn' ]

In the browser there is an exposed say object with the same API.

Adding New Languages

Always seeking pull requests for new languages!

  1. Write your number parser in src/parsers/ and export your parse function which takes a number and returns the number parsed in the language. Be sure to support negative numbers and follow the ESLint rules..
  2. Add the parser to languages.js with [language] as the key. Keep this list alphabetical.
  3. Test it out.
  4. Add your name to the authors list.
  5. Submit a pull request.

Supported Languages

List of parsers.

License

MIT