A library for handling monetary values effectively.
Go to file
2024-05-29 14:14:49 +02:00
.vscode fix(core): update 2019-07-09 00:26:02 +02:00
test fix(core): update 2019-07-09 00:44:27 +02:00
ts fix(core): update 2019-07-09 00:42:23 +02:00
.gitignore fix(core): update 2019-07-09 00:26:02 +02:00
.gitlab-ci.yml fix(core): update 2019-07-09 00:26:02 +02:00
license fix(core): update 2019-07-09 00:26:02 +02:00
npmextra.json update tsconfig 2024-04-14 17:59:44 +02:00
package-lock.json 1.0.6 2019-07-09 00:44:28 +02:00
package.json update description 2024-05-29 14:14:49 +02:00
readme.hints.md update tsconfig 2024-04-14 17:59:44 +02:00
readme.md update tsconfig 2024-04-14 17:59:44 +02:00
tsconfig.json update npmextra.json: githost 2024-04-01 21:36:40 +02:00

@push.rocks/smartmoney

handle monetary values

Install

To start using @push.rocks/smartmoney, you'll first need to install it using npm. Run the following command in your terminal:

npm install @push.rocks/smartmoney --save

This will add @push.rocks/smartmoney to your project's dependencies. Now, you're ready to use it in your TypeScript projects.

Usage

The main functionality of @push.rocks/smartmoney is to handle monetary values effectively, focusing on common tasks such as parsing European numeric strings which may include commas for decimal points and periods for thousands separators. In financial applications, or any software that deals with monetary input in a European format, @push.rocks/smartmoney can be extremely useful.

Basic Example: Parsing European Number Strings

To demonstrate the basic functionality of @push.rocks/smartmoney, consider the task of converting a European-formatted string that represents a monetary value into a number that JavaScript can work with.

The core aspect of @push.rocks/smartmoney you'll be using for this is parseEuropeanNumberString function. Here's how you can use it:

import { parseEuropeanNumberString } from '@push.rocks/smartmoney';

const exampleString = '1.234,56'; // A typical European formatted number string
const resultNumber = parseEuropeanNumberString(exampleString);
console.log(resultNumber); // Logs: 1234.56

This simple example highlights how to convert a string like '1.234,56', which is common in many European countries, into a floating-point number that JavaScript can recognize and work with (1234.56).

Advanced Usage: Integrating with Financial Calculations

Assuming you're building a financial application, handling user inputs in various formats might be a common task. For such scenarios, @push.rocks/smartmoney can help parse these inputs accurately before performing any calculations.

Let's consider you're calculating the total value of a portfolio in euros, based on user inputs that could be formatted in European style:

import { parseEuropeanNumberString } from '@push.rocks/smartmoney';

// User inputs, possibly fetched from a UI layer
const inputs = ['1.000,50', '2.500,00', '3.000,25'];

// Parsing and summing up the total
const total = inputs.reduce((acc, currentValue) => {
  return acc + parseEuropeanNumberString(currentValue);
}, 0);

console.log(`Total Portfolio Value: €${total.toFixed(2)}`);
// Logs: Total Portfolio Value: €6500.75

In this more practical example, @push.rocks/smartmoney ensures that each user input is correctly parsed to a float, regardless of its original format, enabling accurate and reliable financial calculations.

Conclusion and Further Applications

While the examples provided here showcase basic usage and a more integrated scenario, @push.rocks/smartmoney can be deepened further into any financial or data processing application requiring precise handling of monetary formats, especially those catering to users in European countries.

The clear and straightforward API of @push.rocks/smartmoney allows for seamless integration into existing projects, making it easier for developers to focus on the core functionality of their applications without worrying about the nuances of handling monetary values.

As part of your project's evolution, consider contributing to @push.rocks/smartmoney's development or sharing your use cases, helping the library to grow and support even more scenarios beneficial to the developer community.

Note: The usage examples provided are simplified to demonstrate the capabilities of @push.rocks/smartmoney. For further exploration and advanced features, dive into the source code and documentation.

This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the license file within this repository.

Please note: The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.

Trademarks

This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.

Company Information

Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany

For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.

By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.