Socket
Socket
Sign inDemoInstall

@exante/big-decimal

Package Overview
Dependencies
0
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @exante/big-decimal

Utility functions to convert numbers to and from big decimal objects.


Version published
Weekly downloads
3
decreased by-83.33%
Maintainers
3
Install size
8.79 kB
Created
Weekly downloads
 

Readme

Source

BigDecimal number converter

A very small set of utility functions to convert numbers in Big Decimal format to JavaScript numbers and back.

version styled with prettier

Install

npm install --save @exante/big-decimal

Usage

import { toBigDec, fromBigDec } from '@exante/big-decimal';

fromBigDec({ scale: 2, value: 12345 }); // -> 123.45

toBigDec(123.45); // -> { scale: 2, value: 12345 }

Features

  • Robust: The library is tested to behave correctly with all kinds of input. It correctly handles all JavaScript quirks when dealing with numbers and accounts for strings, scientific notation, leading and trailing zeros and invalid input.
  • Lightweight: 800 bytes minified
NOTE: Does not provide BigDecimal arithmetic

This library is intended to be as lightweight as possible. Therefore it only provides helpers to convert numbers to and from BigDecimal format. It does not provide utilities for BigDecimal arithmetic. If you need precision arithmetic in JavaScript, take a look at big.js or bignumber.js

Keywords

FAQs

Last updated on 26 Mar 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc