🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

@odata2ts/converter-decimal

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@odata2ts/converter-decimal

decimal.js based odata2ts compatible converter for OData's `Edm.Int64` and `Edm.Decimal` types

latest
npmnpm
Version
0.2.7
Version published
Maintainers
0
Created
Source

npm (scoped)

Decimal Converter

decimal.js based odata2ts compatible converter for OData's Edm.Int64 and Edm.Decimal types.

Comparison to bignumber.js

From the comparison:

decimal.js was orginally developed through adding support for non-integer powers to bignumber.js, but I decided to release it as a separate library. The main difference between them is that precision is specified in terms of significant digits in decimal.js instead of decimal places, and all calculations are rounded to that precision (similar to Python's decimal module) rather than just those involving division.

bignumber.js is perhaps more suitable for financial applications because the user doesn't need to worry about losing precision unless an operation involving division is used.

decimal.js may be better for more scientific applications as it can handle very small or large values more efficiently. For example, it does not have the limitation of bignumber.js that when adding a value with a small exponent to one with a large exponent, bignumber.js will attempt to perform the operation to full precision, which may make the time taken for the operation unviable.

As mentioned above, decimal.js also supports non-integer powers and adds the trigonometric functions and exp, ln, and log methods. These additions make decimal.js significantly larger than bignumber.js.

Conversions

OData TypeResult TypeConverter IdDescription
Edm.Int64DecimaldecimalConvertersee Decimal documentation
Edm.DecimalDecimaldecimalConvertersee Decimal documentation

Installation

As usual:

npm install --save @odata2ts/converter-decimal

Note, that this converter expects, that you install decimal.js by yourself:

npm install --save decimal.js

Documentation

Decimal Converter Documentation

Main Documentation of odata2ts: https://odata2ts.github.io/

Support, Feedback, Contributing

This project is open to feature requests, suggestions, bug reports, usage questions etc. via GitHub issues.

Contributions and feedback are encouraged and always welcome.

See the contribution guidelines for further information.

Spirit

This project has been created and is maintained in the following spirit:

  • adhere to the OData specification as much as possible
    • support any OData service implementation which conforms to the spec
    • allow to work around faulty implementations if possible
  • stability matters
    • exercise Test Driven Development
    • bomb the place with unit tests (code coverage > 95%)
    • ensure that assumptions & understanding are correct by creating integration tests

License

MIT - see License.

Keywords

decimal.js

FAQs

Package last updated on 08 Feb 2025

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