1.0.0 • Published 4 months ago
shiva99480 v1.0.0
Math Operations
A TypeScript package for performing basic arithmetic operations on numbers and arrays.
Installation
npm install @shiva/math-operations
Usage
import { add, subtract, multiply } from '@shiva/math-operations';
// Working with numbers
const sum = add(5, 3); // 8
const diff = subtract(10, 4); // 6
const prod = multiply(2, 3); // 6
// Working with arrays
const arr1 = [1, 2, 3];
const arr2 = [4, 5, 6];
const arraySum = add(arr1, arr2); // [5, 7, 9]
const arrayDiff = subtract(arr1, arr2); // [-3, -3, -3]
const arrayProd = multiply(arr1, arr2); // [4, 10, 18]
API
add(a: number | number[], b: number | number[]): number | number[]
Adds two numbers or arrays of numbers. If arrays are provided, they must have the same length.
subtract(a: number | number[], b: number | number[]): number | number[]
Subtracts two numbers or arrays of numbers. If arrays are provided, they must have the same length.
multiply(a: number | number[], b: number | number[]): number | number[]
Multiplies two numbers or arrays of numbers. If arrays are provided, they must have the same length.
License
MIT
1.0.0
4 months ago