ez-calc

1.0.4 • Public • Published

ez-calc

A super simple calculator function used to complete the freeCodeCamp Calculator project. The calc function takes four arguements... and input string, a totalArr array (optional), a total string (optional), and a clearSet boolean (optional).

The input value can be a number,-, +, /, *, x, ., =, ac (for All Clear_, c or clear (for clear, which removes the last input. If clear is pressed twice, it's equavalent to All Clear)

To use

import calc from "ez-calc";
 
let input = 2;
let totalArr = [2, "+", 2, "+"];
let total = 4;
let clearSet = false;
 
const calculator = calc(input, totalArr, total, clearSet);
totalArr = calculator[0];
total = calculator[1];
clearSet = calculator[2];

Readme

Keywords

Package Sidebar

Install

npm i ez-calc

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

6.7 kB

Total Files

4

Last publish

Collaborators

  • thebells1111