Convert an number to the equivalent word in the german language.
Zahlen in den das entsprechende Zahlenwort der deutschen Sprache konvertieren
This Package is inspired by https://github.com/salmanm/num-words and extends the idea for the german language.
Note:
-
This package does support typescript
-
This package does not support numbers larger than 12 digits. If a higher number is given it will return the input value.
npm i num-words-de
1 -> Eins
10 -> Zehn
13 -> Dreizehn
1000 -> Eintausend
12345 -> Zwölftausenddreihundertvierundfünfzig
1345000000 -> Eine Milliarde dreihundertfünfundvierzig Millionen
const numToWordsDe = require('num-words-de')
numToWordsDe.numToWord(1) // eins
or
import {numToWord} from "num-words-de"
numToWord(1) // eins
The params are taken within a params-object. The object contains following parameters
{
uppercase: true,
indefinite_eine: false,
indefinite_einer: false,
indefinite_eines: false,
indefinite_einem: false,
indefinite_ein: false
}
uppercase (default true)
-> If return string is upper or lowercase
numToWord(10) // Zehn
numToWord(10, {uppercase:false}) // zehn
Due to some special cases with Indefinitivpronomen following cases for the number one are supported. If multiple of these values are true they are taken in the bottom order and the first one will be executed.
indefinite_eine (default false)
-> If number one should be converted into eine
indefinite_einer (default false)
-> If number one should be converted into einer
indefinite_eines (default false)
-> If number one should be converted into eines
indefinite_einem (default false)
-> If number one should be converted into einem
indefinite_ein (default false)
-> If number one should be converted into ein
numToWord(1) // Eins
numToWord(10, {indefinite_eine:true}) // Zehn
numToWord(1, {indefinite_eine:true}) // Eine
numToWord(1, {indefinite_einer:true}) // Einer
numToWord(1, {indefinite_eines:true}) // Eines
numToWord(1, {indefinite_einem:true}) // Einem
numToWord(1, {indefinite_ein:true}) // Ein
numToWord(1, {indefinite_einem:true, uppercase:false}) // einem
If you are able to detect an issue feel free to create an issue. Please add the input value when doing so.