npm.io
1.0.1 • Published 1 year ago

@dalvindersingh2019/formatprice

Licence
ISC
Version
1.0.1
Deps
0
Size
5 kB
Vulns
0
Weekly
0

��---

=��� Price Formatter

Format price numbers with currency symbols effortlessly. Ensure consistent and clear price display in your JavaScript applications.


=��� Installation

Install via npm:

npm install price-formatter

=؀� Usage

const formatPrice = require('price-formatter');

const price = formatPrice('

=���� Functionality

formatPrice(symbol: string, price: number): string
  • symbol: Currency symbol (e.g., $, , )
  • price: Number to format
=�� Returns:
  • If price is 0 or not a number �! "symbol 0"
  • If price is negative �! "-symbol number"
  • If price is positive �! "symbol number"

=ء� Examples

formatPrice('

>�� Contributing

  1. Fork the repo

  2. Clone your fork

    git clone https://github.com/your-username/price-formatter.git
  3. Create a branch

    git checkout -b feature/YourFeature
  4. Make your changes

  5. Commit

    git commit -m "Add some feature"
  6. Push & PR

    git push origin feature/YourFeature

Open a Pull Request from your forked branch on GitHub.


=��� License

Licensed under the ISC License. See the LICENSE file for details.


, 100); // => "$ 100"

=���� Functionality

__CODE_BLOCK_2__
  • symbol: Currency symbol (e.g., __INLINE_CODE_0__, __INLINE_CODE_1__, __INLINE_CODE_2__)
  • price: Number to format
=�� Returns:
  • If __INLINE_CODE_3__ is 0 or not a number �! __INLINE_CODE_4__
  • If __INLINE_CODE_5__ is negative �! __INLINE_CODE_6__
  • If __INLINE_CODE_7__ is positive �! __INLINE_CODE_8__

=ء� Examples

__CODE_BLOCK_3__

>�� Contributing

  1. Fork the repo

  2. Clone your fork

    __CODE_BLOCK_4__
  3. Create a branch

    __CODE_BLOCK_5__
  4. Make your changes

  5. Commit

    __CODE_BLOCK_6__
  6. Push & PR

    __CODE_BLOCK_7__

Open a Pull Request from your forked branch on GitHub.


=��� License

Licensed under the ISC License. See the __INLINE_CODE_9__ file for details.


, 100); // "$ 100" formatPrice('� ', -50); // "-� 50" formatPrice('� ', 0); // "� 0" formatPrice('�', 'text'); // "� 0"

>�� Contributing

  1. Fork the repo

  2. Clone your fork

    __CODE_BLOCK_4__
  3. Create a branch

    __CODE_BLOCK_5__
  4. Make your changes

  5. Commit

    __CODE_BLOCK_6__
  6. Push & PR

    __CODE_BLOCK_7__

Open a Pull Request from your forked branch on GitHub.


=��� License

Licensed under the ISC License. See the __INLINE_CODE_9__ file for details.


, 100); // => "$ 100"

=���� Functionality

__CODE_BLOCK_2__
  • symbol: Currency symbol (e.g., __INLINE_CODE_0__, __INLINE_CODE_1__, __INLINE_CODE_2__)
  • price: Number to format
=�� Returns:
  • If __INLINE_CODE_3__ is 0 or not a number �! __INLINE_CODE_4__
  • If __INLINE_CODE_5__ is negative �! __INLINE_CODE_6__
  • If __INLINE_CODE_7__ is positive �! __INLINE_CODE_8__

=ء� Examples

__CODE_BLOCK_3__

>�� Contributing

  1. Fork the repo

  2. Clone your fork

    __CODE_BLOCK_4__
  3. Create a branch

    __CODE_BLOCK_5__
  4. Make your changes

  5. Commit

    __CODE_BLOCK_6__
  6. Push & PR

    __CODE_BLOCK_7__

Open a Pull Request from your forked branch on GitHub.


=��� License

Licensed under the ISC License. See the __INLINE_CODE_9__ file for details.