aimens-calculator 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/calculator.js +22 -0
  3. package/package.json +12 -0
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # calculator package
package/calculator.js ADDED
@@ -0,0 +1,22 @@
1
+ class Calculator {
2
+ add(a, b) {
3
+ return a + b;
4
+ }
5
+
6
+ subtract(a, b) {
7
+ return a - b;
8
+ }
9
+
10
+ multiply(a, b) {
11
+ return a * b;
12
+ }
13
+
14
+ divide(a, b) {
15
+ if (b === 0) {
16
+ throw new Error("Cannot divide by zero.");
17
+ }
18
+ return a / b;
19
+ }
20
+ }
21
+
22
+ module.exports = Calculator;
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "aimens-calculator",
3
+ "version": "1.0.0",
4
+ "main": "calculator.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1"
7
+ },
8
+ "keywords": [],
9
+ "author": "Aimen Sajjad",
10
+ "license": "ISC",
11
+ "description": "This is a calculator"
12
+ }