Skip to content

NPM module for converting numbers to spoken word formats (e.g. 1375 becomes thirteen seventy five). Various formatting options are provided to support simple digits, double digits, leading zeros, alphanumeric values, and variations on the word for 'zero' such a 'O'

License

Notifications You must be signed in to change notification settings

scottbea/spoken-numbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spoken-numbers

NPM version Build Status Dependency Status Coverage percentage


Convert numbers to spoken word formats (e.g. 1375 becomes thirteen seventy five). Various formatting options are provided to support simple digits, c

Install with npm

$ npm install --save spoken-numbers

Usage

var spokenNumbers = require('spoken-numbers');

var words1 = spokenNumbers.toSpoken(1724, 'dd'); // => 'seventeen twenty four'
var words2 = spokenNumbers.toSpoken(1701, 'dd:o'); // => 'seventeen o one'
var words3 = spokenNumbers.toSpoken(1000, 'dd:o'); // => 'ten zero zero'
var words4 = spokenNumbers.toSpoken('AA1901', 'dd:o'); // => 'A A nineteen o one'
var words5 = spokenNumbers.toSpoken('AA1901', 'd'); // => 'A A one nine zero one'

Formats

  • d - Formats all numbers as individual digits. Example: 14,302,033 becomes one four three zero two zero three three
  • dd - Formats all numbers as individual digits. Example: 14,30,20,33 becomes fourteen thirty twenty thirty three
  • w - Formats all numbers in a verbose form, including named units. Example: 14,302,033 becomes fourteen million three hundred and two thousand thirty three
  • d:o - Formats all numbers as individual digits but replaces zero with 0. Example: 14,302,033 becomes one four three o two o three three

License

This code is licensed under the MIT license for Scott Beaudreau. For more information, please refer to the LICENSE file.

About

NPM module for converting numbers to spoken word formats (e.g. 1375 becomes thirteen seventy five). Various formatting options are provided to support simple digits, double digits, leading zeros, alphanumeric values, and variations on the word for 'zero' such a 'O'

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published