english-ordinals

Ordinal numbers in English: 1 => first etc.

Usage no npm install needed!

<script type="module">
  import englishOrdinals from 'https://cdn.skypack.dev/english-ordinals';
</script>

README

english-ordinals

A very simple Node.js module that gives the ordinal representation of numbers in English: 2 => second, 20 => twentieth, etc.

Based on:

  • n2words to first build cardinal numbers
  • make ordinals code thanks to Martin Eneqvist the author

Installation

npm install english-ordinals

Usage

const ordinals = require('english-ordinals');

// twentieth
console.log(`20 => ${ordinals.getOrdinal(20)}`);

dependencies

  • n2words under MIT license
  • contains code from number-to-words under MIT license