/simple-calculator

A simple calculator following the BODMAS rule

Primary LanguageTypeScript

Simple Calculator

Simple, opinionated calculator which follows the BODMAS rule built with TypeScript.

Features

  • Multiple expressions
  • Handle invalid expressions gracefully
  • No external dependencies or ready-made libraries for expression evaluation.

Requirements

  • Node.js 10+

Run this application

To run this application

  • First install the project dependencies with npm install.
  • Run npm run compile.
  • You can now call the calculator by invoking node ./build/src/index.js YOUR_EXPRESSION_HERE or simply node . YOUR_EXPRESSION_HERE.

Testing

This project comes with some pre-defined test that you can run with npm test. Feel free to add yours. And if you encounter a bug please submit an issue or a PR if you feel adventurous 😎 💪.

Licence

  • MIT