Skip to content
/ nTh.js Public

Weighing in at 368 bytes minified, nTh.js is a javascript micro-library to return ordinal suffixes from integers (ie: 1st, 2nd, 3rd, 7th of 9)

License

Notifications You must be signed in to change notification settings

dperish/nTh.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nTh.js

Weighing in at 368 bytes minified, nTh.js is a javascript micro-library to return ordinal suffixes from integers (ie: 1st, 2nd, 3rd, 7th of 9).

======

Standard Usage - nth(int):

nth(4077); produces 4077th

Nth of Set - nth.of(int, int):

nth.of(1,3); produces 1st of 3

Via jQuery Class Selection:

  <ul>
    <li class='nth'>0</li>
    <li class='nth'>1</li>
    <li class='nth'>2</li>
    <li class='nth'>3</li>
    <li class='nth'>4077</li>
  </ui>
$(function(){
  $(".nth").html(function(i,e) {
      return nth(e);
  });
});

produces:

  • 0th
  • 1st
  • 2nd
  • 3rd
  • 4077th

======

Contributions

This library was written by:

Any & all contributions are welcomed.

======

License

nTh.js is free (as in love), and is provided under The MIT License (MIT)

About

Weighing in at 368 bytes minified, nTh.js is a javascript micro-library to return ordinal suffixes from integers (ie: 1st, 2nd, 3rd, 7th of 9)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •