Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@exante/big-decimal

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

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.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
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

Package last updated on 26 Mar 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc