Code Monkey home page Code Monkey logo

ordinal.js's Introduction

ordinal

Version

A compact module to provide the English ordinal letters following a numeral.

If other languages are required, please submit an issue.

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 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 MIT

ordinal.js's People

Contributors

azizhk avatar dcousens avatar joshuapinter avatar omrilotan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ordinal.js's Issues

Remove ordinal

It would be very nice if this had a function for removing ordinals

Publish on npm

@ghost it seems you stopped publishing this package on GitHub and therefore the npm link is dead.

Would you be happy to add me as a contributor to https://www.npmjs.com/package/ordinal and I can release this package as version 1.0.0?

Understandable if not, I'll publish under another name.

The code is entirely new, so I didn't carry over the license, but I can reference you if you'd like...

Instead of using `indicator`, pass a `boolean` as the second param.

Maybe something like this:

// Method definition: ordinal( number, includeNumber = true ).

ordinal(2);        // "2nd"
ordinal(2, false); // "nd"
ordinal(2, true);  // "2nd"

Defaults to include the number but you can pass false to the second param and it will not include the number.

Thoughts?

Browser version

Please release a browser version of this package which works on the client side and does not require the use of "import" to use this package but to simply use the script tag to use the package.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.