Giter Site home page Giter Site logo

n2words's Introduction

n2words

Test Coverage Status npm npm jsDelivr

n2words converts numerical numbers into written ones, supports 27 languages, and has zero dependencies.

Example

n2words(123)   // 'one hundred and twenty-three'
n2words(-1.5)  // 'minus one point five'

n2words(123, {lang: 'fr'})  // 'cent vingt-trois'
n2words(123, {lang: 'es'})  // 'ciento veintitrés'
n2words(123, {lang: 'ar'})  // 'مائة و ثلاثة و عشرون'

See the Wiki for examples and advanced usage like importing only specific languages.

Install

npm install n2words

Usage

ESM

import n2words from 'n2words'

CommonJS (dynamic import)

import('n2words').then(({default: n2words}) => {
    n2words(100)
})

Browser

<script src="./n2words.js"></script>
<script>
    n2words(100)
</script>

n2words is also available on jsDelivr.

Supported Languages

  • en (English, default)
  • ar (Arabic)
  • az (Azerbaijani)
  • cz (Czech)
  • dk (Danish)
  • de (German)
  • es (Spanish)
  • fr (French)
  • fr-BE (French (Belgium))
  • fa (Farsi)
  • he (Hebrew)
  • hr (Croatian)
  • hu (Hungarian)
  • id (Indonesian)
  • it (Italian)
  • ko (Korean)
  • lt (Lithuanian)
  • lv (Latvian)
  • nl (Dutch)
  • no (Norwegian)
  • pl (Polish)
  • pt (Portuguese)
  • ru (Russian)
  • sr (Serbian)
  • tr (Turkish)
  • uk (Ukrainian)
  • vi (Vietnamese)
  • zh (Chinese)

Contributing

This library is in active development. We want to improve the design and process for language contributors and add more languages. Bug reports and feature requests are also beneficial!

License

MIT

n2words's People

Contributors

dylandoamaral avatar forzagreen avatar jacco avatar jvanaert avatar k4czp3r avatar krzyhan avatar lagavuliner avatar ljinke avatar omarius avatar rivamarco avatar tylervigario avatar victortaleb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.