Convert a float number to Croatian words.
Useful when in need to show a Money amount in words like i.e:
Iznos: 121024.05
Slovima: stodvadesetjednatisućadvadesetčetiri kune i pet lipa
Supported: modern browsers. (To support IE use Babel);
convertHR(number [, {options}])
where "number" is a float number up to Number.isSafeInteger(), the Croatian representation of that value will be returned, otherwise a String "Error"
will be returned
Option | Type | Default value | Description |
---|---|---|---|
delimiter | String | "" |
Use " " to delimit words with space |
simple | Boolean | false |
Set to true to remove unnecessary "jedan/na" for round thousands numbers |
import {convertHR} from "./convert-hr.js";
const words = convertHR(1042.31);
jednatisućačetrdesetdvije kune i tridesetjedna lipa
const words = convertHR(1042.31, {simple: true});
tisućučetrdesetdvije kune i tridesetjedna lipa
const words = convertHR(1042.31, {simple: true, delimiter: " "});
tisuću četrdeset dvije kune i trideset jedna lipa
To create a readable test.txt
file with your test results from test.js
$ node --experimental-modules test.js > test.txt
MIT