New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

coderzhao_math

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coderzhao_math

A simple JavaScript package providing basic arithmetic operations with error handling.

latest
npmnpm
Version
1.0.1
Version published
Weekly downloads
1
-50%
Maintainers
0
Weekly downloads
 
Created
Source

Math Operations Package

A simple JavaScript package providing basic arithmetic operations with error handling.

Installation

npm install coderzhao_math

Usage

const math = require('coderzhao_math');

// Basic arithmetic examples
const sum = math.add(10, 5);        // Returns: 15
const diff = math.subtract(20, 8);   // Returns: 12
const product = math.multiply(4, 3); // Returns: 12
const quotient = math.divide(15, 5); // Returns: 3

// Error handling example
try {
    math.divide(10, 0);
} catch (error) {
    console.error(error.message); // Outputs: "Division by zero is not allowed."
}

Features

  • Four basic arithmetic operations
  • Error handling for division by zero
  • Clean and simple API
  • Pure JavaScript implementation

API Reference

add(a, b)

Adds two numbers and returns their sum.

  • Parameters: a and b (numbers)
  • Returns: Sum of a and b

subtract(a, b)

Subtracts the second number from the first.

  • Parameters: a and b (numbers)
  • Returns: Difference between a and b

multiply(a, b)

Multiplies two numbers.

  • Parameters: a and b (numbers)
  • Returns: Product of a and b

divide(a, b)

Divides the first number by the second.

  • Parameters: a and b (numbers)
  • Returns: Quotient of a divided by b
  • Throws: Error if b is zero

License

ISC

Author

chderzhao

FAQs

Package last updated on 06 Aug 2025

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