npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

ordinal

1.0.2 • Public • Published

ordinal

build status Version

Module to provide the ordinal letters following a numeral.

Examples

Numbers only, anything else will throw a TypeError.

var ordinal = require('ordinal')
 
ordinal(1) // '1st'
ordinal(2) // '2nd'
ordinal(3) // '3rd'
ordinal(4) // '4th'
 
ordinal(11) // '11th'
ordinal(12) // '12th'
ordinal(13) // '13th'
 
ordinal(21) // '21st'
ordinal(22) // '22nd'
ordinal(23) // '23rd'
ordinal(24) // '24th'

To get just the indicator:

var ordinal = require('ordinal')
var indicator = require('ordinal/indicator')
 
indicator(1) // 'st'
indicator(2) // 'nd'
indicator(3) // 'rd'
indicator(4) // 'th'
 
indicator(11) // 'th'
indicator(12) // 'th'
indicator(13) // 'th'
 
indicator(21) // 'st'
indicator(22) // 'nd'
indicator(23) // 'rd'
indicator(24) // 'th'

License ISC

install

npm i ordinal

Downloadsweekly downloads

173,517

version

1.0.2

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability