Coder Social home page Coder Social logo

winoteam / rescript-big Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 0.0 363 KB

๐ŸŽก Zero-cost bindings to Big.js library.

Home Page: https://github.com/winoteam/rescript-big

License: MIT License

TypeScript 8.74% JavaScript 1.27% ReScript 89.99%
ocaml reasonml bigjs decimals rescript rescript-binding

rescript-big's Introduction

rescript-big

Actions Status

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: fromFloator 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

  1. Fork this repository to your own GitHub account and then clone it to your local device
  2. Install dependencies using Yarn: yarn
  3. Ensure that the tests are passing using yarn test
  4. 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.

rescript-big's People

Contributors

dependabot[bot] avatar gensjaak avatar leolebras avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rescript-big's Issues

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.