Giter Club home page Giter Club logo

wealth's Introduction

Wealth · GitHub license npm version

Wealth is a JavaScript library for handling money calculation, allocation, formatting, serialization, and currency handling.

There are many libraries out there that handle money or currency, but there's not one that offers a complete feature set. This library provides a uniform interface for various money-related operations.

Under the hood, it uses bignumber.js for calculations.

Installation

npm install wealth

or

yarn add wealth

Documentation

https://amirmohsen.github.io/wealth/

wealth's People

Contributors

amirmohsen avatar dependabot[bot] avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wealth's Issues

Currency in operations

If currency doesn't match in all operations, an error must be thrown. Create custom errors that can be caught based on type.
Create a new method in the Money class that does currency comparison,

Babel setup

Babel setup
Check other open-source projects for inspiration

Currency refactor

Automatically spread currency settings onto this and only use a getter for the entire settings object rather than each individual setting.

Naming

Come up with a good name that is available on the npm registry

React money hoc

Wrapping any component that has a text input to enforce a given currency format as the user types

Use getters

Instead of methods like getDecimalDigit, use get decimalDigit.
Make the default amount and toString return a string float with fixed decimal points.

Freeze objects

To achieve true immutability, ensure you freeze your objects.

Internationalisation

Think about how we would format different currencies based on the locale.

We could just replicate a subset of the functionality in ICU; in particular their patterns for formatting numbers would be useful for outputting currencies in different locales.

Modularize

Separate functionalities into separate mixins with each one having to be manually set or a function to build all in one go.

  • All ISO currencies
  • One currency at a time
  • Formatter
  • Parser
  • Calculator
  • Rounding Modes
  • EqualityChecker
  • Allocator (needs calculator)

Functional Tests

For each of the builds: esm, csj and umd
For each way of consuming the lib: full, oo and fn

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.