spoken-numbers

0.0.4 • Public • Published

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('AA1901', 'dd:o'); // => 'A A nineteen o one'
var words4 = 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.

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i spoken-numbers

    Weekly Downloads

    3

    Version

    0.0.4

    License

    MIT

    Last publish

    Collaborators

    • scottbea