Skip to content

Simple utility to translate from regular numbers to their ordinal representation.

License

Notifications You must be signed in to change notification settings

GeekAb/js-ordinal

Repository files navigation

js-ordinal

Simple utility to translate numeral to their english ordinal representation.

Install

First of all, you need to have npm or yarn installed. Follow these steps, npm or yarn, to install one of them.

npm

npm install --save js-ordinal

yarn

yarn add js-ordinal

Few Examples

const o = require('js-ordinal')

o.toOrdinal(1) // '1st'
o.toOrdinal(2) // '2nd'

o.toOrdinal(11) // '11th'
o.toOrdinal(12) // '12th'

o.toOrdinal(21) // '21st'

Getting only ordinal

o.ordinalSuffix(1) // 'st'

Documentation

You can know more about the project on the npm website and the official website.

TODO

  • Add unit test

  • Support additional language

About

Simple utility to translate from regular numbers to their ordinal representation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published