Metric/Imperial Converter
Metric/Imperial Converter
Open website
Metric/Imperial Converter
Published on Oct 19, 2021

If you want to fork the project and try the tests on your own platform / computer, you'll have to add NODE_ENV=test to your replit secrets / .env file to enable them (it's in the sample.env but commented out because replit does not use env files).

This will convert between a few metric/imperial units & return a string + detailed JSON object.

Valid input: no spaces, no special characters, only defined units. Numbers can be int or simple frac.

Sure, it'd be easier if we'd enforce the correct input by specialized fields, but I could not do that because of freecodecamp's testing & user stories.

**Valid input characters

  • Numbers 0-9

  • . decimals

  • / fractions

  • letters for units

**Valid unit inputs:

  • L, gal

  • km, mi

  • kg, lbs

**Valid number inputs:

  • Integers: 2, 13..

  • Decimals: 2.5, 1.33..

  • Fractions: 2/5, 2.5/6, 2.5/10.3..

Similar apps
No comments yet
to comment