Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

the-math

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

the-math - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

2

package.json
{
"name": "the-math",
"version": "1.0.1",
"version": "1.1.0",
"description": "Core of TheMath Calculator",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -1,3 +0,74 @@

# Calculator
# TheMath
Lib with function to execute operations arithmetics, and you can resolve string operation with resolve.
## Installation
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/package/the-math).
Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
Use npm:
```
$ npm install the-math
```
Use yarn:
```
$ yarn add the-math
```
## Features
- subtract - Solve subtraction between 2 numbers.
- Sum - Solve sum between 2 numbers.
- divide - Solve division between 2 numbers.
- multiply - Solve multiplication between 2 numbers.
- resolve - Solve a string operation arithmetic.
## Exemples
1. Solve subtraction between 2 numbers.
```typescript
import TheMath from 'the-math';
const result = TheMath.subtract(10, 3);
// result: 7
```
2. Solve subtraction between 2 numbers.
```typescript
import TheMath from 'the-math';
const result = TheMath.sum(14, 7);
// result: 21
```
3. Solve division between 2 numbers.
```typescript
import TheMath from 'the-math';
const result = TheMath.divide(21, 3);
// result: 3
```
4. Solve multiplication between 2 numbers.
```typescript
import TheMath from 'the-math';
const result = TheMath.multiply(6, 3);
// result: 18
```
5. Solve a string operation arithmetic.
```typescript
import TheMath from 'the-math';
const result = TheMath.resolve('12+4*3*9/2+1');
// result: 67
```
# Calculator Exercise
**Tier:** 1-Beginner

@@ -8,3 +79,3 @@

this problem you will create a calculator that supports basic arithmetic
calculations on integers.
calculations on integers.

@@ -18,47 +89,1 @@ The styling is up to you so use your imagination and get creative! You might

- You may not use the `eval()` function to execute calculations
## User Stories
- [ ] User can see a display showing the current number entered or the
result of the last operation.
- [ ] User can see an entry pad containing buttons for the digits 0-9,
operations - '+', '-', '/', and '=', a 'C' button (for clear), and an 'AC'
button (for clear all).
- [ ] User can enter numbers as sequences up to 8 digits long by clicking on
digits in the entry pad. Entry of any digits more than 8 will be ignored.
- [ ] User can click on an operation button to display the result of that
operation on:
* the result of the preceding operation and the last number entered OR
* the last two numbers entered OR
* the last number entered
- [ ] User can click the 'C' button to clear the last number or the last
operation. If the users last entry was an operation the display will be
updated to the value that preceded it.
- [ ] User can click the 'AC' button to clear all internal work areas and
to set the display to 0.
- [ ] User can see 'ERR' displayed if any operation would exceed the
8 digit maximum.
## Bonus features
- [ ] User can click a '+/-' button to change the sign of the number that is
currently displayed.
- [ ] User can see a decimal point ('.') button on the entry pad to that
allows floating point numbers up to 3 places to be entered and operations to
be carried out to the maximum number of decimal places entered for any one
number.
## Useful links and resources
- [Calculator (Wikipedia)](https://en.wikipedia.org/wiki/Calculator)
- [MDN](https://developer.mozilla.org/en-US/)
## Example projects
- [BHMBS - JS-Neumorphic-Calculator](https://barhouum7.github.io/JS-Neumorphic-Calc.github.io/)
- [Javascript iOS Style Calculator](https://codepen.io/ssmkhrj/full/jOWBQqO)
- [Javascript Calculator](https://codepen.io/giana/pen/GJMBEv)
- [React Calculator](https://codepen.io/mjijackson/pen/xOzyGX)
- [Javascript-CALC](https://github.com/x0uter/javascript-calc)
- [Sample Calculator](https://sevlasnog.github.io/sample-calculator)
- [Python Calculator](https://github.com/kana800/Side-Projects/tree/master/1-Beginner/calculator)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc