ml-math
v1.4.5
Published
Hi! I developed this small module for myself for fun. It focuses on mathematical operations and number manipulation.
Downloads
5
Readme
ml-math
Hi! I developed this small module for myself for fun. It focuses on mathematical operations and number manipulation.
Module
This module is divided into
numbers
- isNumeric
- isOdd
- isEven
- isPrime
calculator
- add
- addArray
- subtract
- subtractArray
- multiply
- multiplyArray
- divide
- divideArray
Usage
import via
npm i ml-math
or
yarn add ml-math
require
const {numbers, calculator} = require('ml-math');
and use it
let val = 10;
if (numbers.isNumeric(val) && numbers.isEven(val)) {
val = calculator.add(val, 3); // 13
}
console.log(calculator.multiply(val, 10)); // 130
const array = [1, 2, 3, 4, 5];
console.log(calculator.multiplyArray(array)); // 120