open-index/open-npm huggingface dataset:
npm package: @planetguru/oddsconverter
Description: convert odds between decimal and fractional formats
Latest version: 0.2.0

## Description

This is a small library to perform odds conversions. It provides the following functionality:

1. Convert from decimal to fractional odds
2. Convert from fractional to decimal odds

It also has the following utilities within it

1. Simplify a fraction down to it's simplest top-heavy form
2. Get the greatest common denominator from two submitted values
3. Count the number of decimal places on a floating point value

---

## Known bugs

All tests pass except for the one scenario of converting from 1.33 to 1/3.  For some reason this test fails and I don't have the time now to figure out why - I mean the test itself is fine, but the implementation needs fixing, because the converter returns 1.33 as 33/100 which is technically the wrong result (by a tiny margin).

---

## Unit tests

To run the unit tests, run the following
$npm test

you should see output that resembles this:

     @planetguru/oddsconverter@0.1.4 test /Users/christopherlacy-hulbert/lopment/javascript/oddsconverter
     mocha
    
     odds converter
        convert fractional to decimal
          ✓ 4/3 converts to 2.33
        convert fractional to decimal
          ✓ 4/3 converts to 2.33
        convert decimal to fractional
          ✓ 3.25 converts to 9/4
        convert decimal to fractional
          ✓ convert decimal odds
        get greatest common denominator
          ✓ finds 25/150 GCD to be 25
          ✓ finds 10/145 GCD to be 5
        Simplify fraction
          ✓ convert 50/100 to 1/2
        Count decimal places
          ✓ counts 3 in 5.425
        Count decimal places
          ✓ counts 0 in 543
        Count decimal places
          ✓ counts 1 in 543.3
        Count decimal places, exclude trailing zeros
          ✓ counts 1 in 543.300
    
    
      11 passing (11ms)

If any tests are failing, they will also be reported.  Please be sure to cover all functions with unit tests which exercise all happy path scenarios and some edge cases if you can think of any.