0.3.1 • Published 8 months ago

react-ordinals v0.3.1

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

React Ordinals

npm version

license

React Ordinals is a package used to get number ordinals in react apps

Installation

Install the package using npm:

npm install react-ordinals

Install the package using yarn:

yarn add react-ordinals

Install the package using bun:

bun add react-ordinals

Usage

Here's a basic example of how to use react-ordinals:

import React from "react";
import { WordOrdinal } from "react-ordinals";

const App = () => {
  const numberRange = Array.from({length: 50}, (_, index) => index + 1);
  return (
    <section>
      {numberRange.map((number) => (
        <WordOrdinal
          number={number}
          shouldBeTitleCase={true}
        />  
      ))}
    </section>
  );
};

export default App;

API

WordOrdinal

The WordOrdinal component is responsible for converting numbers into their ordinal form.

Props:

  • number (required): The number to be converted into an ordinal form.
  • shouldBeTitleCase (required): A boolean indicating whether the result should be in title

Examples

Example 1: Word Ordinal

const App = () => {
  return (
    <section>
      <WordOrdinal
        number={14}
        shouldBeTitleCase={false}
      />  
    </section>
  );
};

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

0.3.1

8 months ago

0.3.0

8 months ago

0.2.7

8 months ago

0.2.6

8 months ago

0.2.5

8 months ago

0.2.4

8 months ago

0.2.3

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.1.1

8 months ago

0.1.0

8 months ago