The library has been designed to convert any integer or double to its Azerbaijani description. You can add it to your node project by writing:
npm install number-to-azerbaijani-word --save
or yarn add number-to-azerbaijani-word
To use the library in your NodeJS project, import it in your file and call spellNumberInAz
function.
const numberSpelling = require('number-to-azerbaijani-word');
const { spellNumberInAz } = numberSpelling;
console.log(spellNumberInAz(0)); // output: 'sıfır'
console.log(spellNumberInAz(-738)); // output: 'mənfi yeddi yüz otuz səkkiz'
console.log(spellNumberInAz(990999)); // output: 'doqquz yüz doxsan min doqquz yüz doxsan doqquz'
console.log(spellNumberInAz(-1234567));
// output: 'mənfi bir milyon iki yüz otuz dörd min beş yüz altmış yeddi'
console.log(spellNumberInAz(Number.MAX_SAFE_INTEGER));
// doqquz kvadrilyon yeddi trilyon yüz doxsan doqquz milyard iki yüz əlli dörd milyon yeddi yüz qırx min doqquz yüz doxsan bir
Usage with ES6 imports:
import React from 'react';
import { spellNumberInAz } from 'number-to-azerbaijani-word';
export default function App() {
return (
<div>
<h1>{spellNumberInAz(123)}</h1>
</div>
);
}
If you want to use it in the browser then ES5 bundled version is available in NPM CDN. Simple, add following script to your HTML file and use it.
<script src="https://unpkg.com/number-to-azerbaijani-word@3.1.7/dist/number-to-az-word.umd.min.js"></script>
<script>
console.log(spellNumberInAz(66)); // output: 'altmış altı'
console.log(spellNumberInAz(-31)); // output: 'mənfi otuz bir'
</script>
Please do not hesitate report issues, send pull requests about the code that you think is wrong or could be written better.