is-equal-numbers
v1.0.2
Published
Most required package to check whether two numbers are equal or not
Downloads
3
Readme
is-equal-numbers
A simple npm package to check whether two given numbers are equal.
Installation
You can install this package using npm:
npm install is-equal-numbers
Usage
After installation, you can require and use the package in your project as follows:
const isEqualNumbers = require('is-equal-numbers');
console.log(isEqualNumbers(10, 10)); // true
console.log(isEqualNumbers(5, 3)); // false
Function Signature
isEqualNumbers(num1, num2)
Parameters:
- num1:
number
- The first number to compare. - num2:
number
- The second number to compare.
Returns:
boolean
- Returnstrue
if the numbers are equal, otherwisefalse
.
Throws:
- An error if either of the arguments is not a number.
Example
const isEqualNumbers = require('is-equal-numbers');
try {
console.log(isEqualNumbers(7, 7)); // true
console.log(isEqualNumbers(10, '10')); // Error: Both arguments must be numbers.
} catch (error) {
console.error(error.message);
}
License
This project is licensed under the ISC License.