@mayar-elabbasy/simple-calculator
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

simple-calculator

Simple calculator package that includes the main arithmetic operations packed up in one place

Installation

npm i @mayar-elabbasy/simple-calculator

Usage

  • The Supported Operators are '+' | '-' | '*' | '/'
  • The function should accept an operator as the first param, and the second param is the operands with at least 2 numbers to calculate them & you can add as many numbers as you want
import { handleArithmeticOperation } from '@mayar-elabbasy/simple-calculator';

console.log("sumResult", handleArithmeticOperation("+", 1, 2, 3, 4, 5)); // Output: 15
console.log("subtractionResult", handleArithmeticOperation("-", 10, 5, 2)); // Output: 3
console.log("multiplicationResult", handleArithmeticOperation("*", 2, 4, 6)); // Output: 48
console.log("divisionResult", handleArithmeticOperation("/", 100, 5)); // Output: 20

Author

Mayar Elabbasy

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Package Sidebar

Install

npm i @mayar-elabbasy/simple-calculator

Weekly Downloads

0

Version

1.0.1

License

ISC

Unpacked Size

3.53 kB

Total Files

4

Last publish

Collaborators

  • mayar-elabbasy