react-number-shortner

1.0.3 • Public • Published

react-number-shortner

react-number-shortner is a React package that converts numbers into a formatted string with the appropriate symbol (k, m, b) based on the magnitude of the number.

Installation

npm install react-number-shortner

Usage

To use the package in your project, import the NumberShortener function from the package:

import React from "react";
import NumberShortener  from "react-number-shortner";

function App() {
  return (
    <div>
      <NumberShortener number={12345} /> // Output: 12.3k
    </div>
  );
}

export default App;

API

The NumberShortener function takes a single argument - the number to be formatted - and returns a string with the formatted number.

numberFormat(number: number): string;

Package Sidebar

Install

npm i react-number-shortner

Weekly Downloads

4

Version

1.0.3

License

ISC

Unpacked Size

1.83 kB

Total Files

3

Last publish

Collaborators

  • valpha