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