Package Exports
- rescript-big
- rescript-big/lib/Big.bs.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rescript-big) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
rescript-big
Zero-cost bindings to Big.js library.
In this version only these methods are supported: toFixed
, plus
, minus
, div
, times
, valueOf
, round
, eq
, gt
, gte
, lt
and lte
It also have some converters and shortcuts for converting an existing value or making a Big value, such as: fromFloat
or toFloat
.
It's accompanied with an Operators
module which override some operators like +.
, *.
, /.
and -.
📦 Installation
Run the following command:
$ yarn add rescript-big
Then add rescript-big
to your bsconfig.json
's dependencies:
{
"bs-dependencies": [
+ "rescript-big"
]
}
💻 Usage
open! Big.Operators
let a = 201.57512->Big.fromFloat
Js.log(a->Big.toFixed(2)) // 201.58
// Compiler error: 1. is a float, wanted Big.t
let c = a *. 1.
// OK
let b = 1.->Big.fromFloat
let c = a *. b
Js.log(Big.valueOf(c)) // 201.57512
🕺 Contribute
🚀 Want to hack on rescript-big
? Follow the next instructions
- Fork this repository to your own GitHub account and then clone it to your local device
- Install dependencies using Yarn:
yarn
- Ensure that the tests are passing using
yarn test
- Send a pull request 🙌
Remember to add tests for your change if possible.
👋 Questions
If you have any questions, feel free to open an issue. Please check the Big.js docs before submitting an issue.