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

calc.math

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calc.math

This is a simple calculator package.

  • 1.0.0
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

This is a simple calculator package.

First install the package. npm i calculator.js

Then, import it.

const Calculator = require("calculator.js");
const calc = new Calculator();

Add numbers.

const num = calc.add(1,2);
console.log(num); // Logs 3 into the console.
console.log(num === 3); // Logs true into the console.

Subtract numbers.

const num = calc.subtract(1,2); // Don't worry about putting the greatest number first!
console.log(num); // Logs 1 into the console.
console.log(num === 1); // Logs true into the console.

Multiply numbers.

const multiply = calc.multiply(1,2);
console.log(num); // Logs 2 into the console.
console.log(num === 2); // Logs true into the console.

Divide numbers.

const num = calc.divide(5,10); // Don't worry about putting the greatest number first!
console.log(num); // Logs 2 into the console.
console.log(num === 2); // Logs true into the console.

Round numbers: Add numbers.

const num = calc.add(0.5,10,true);
console.log(num); // Logs 10 into the console.
console.log(num === 10); // Logs true into the console.

Subtract numbers.

const num = calc.subtract(1,2.5,true); // Don't worry about putting the greatest number first!
console.log(num); // Logs 1 into the console.
console.log(num === 1); // Logs true into the console.

Multiply numbers.

const multiply = calc.multiply(1,10.5,true);
console.log(num); // Logs 10 into the console.
console.log(num === 10); // Logs true into the console.

Divide numbers.

const num = calc.divide(1,10.5,true); // Don't worry about putting the greatest number first!
console.log(num); // Logs 10 into the console.
console.log(num === 10); // Logs true into the console.

FAQs

Package last updated on 16 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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