New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rgsoft/math

Package Overview
Dependencies
Maintainers
0
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rgsoft/math - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

8

dist/index.d.ts

@@ -171,3 +171,9 @@ declare class Complex {

declare function mod(n: number, m: number): number;
/**
* Gets the greatest common divisor
* @param { number } a
* @param { number } b
*/
declare function gcd(a: number, b: number): number;
export { Complex, Line, Segment, Vector, mod };
export { Complex, Line, Segment, Vector, gcd, mod };

@@ -27,2 +27,3 @@ "use strict";

Vector: () => Vector,
gcd: () => gcd,
mod: () => mod

@@ -405,3 +406,3 @@ });

// src/modulo.ts
// src/number.ts
function mod(n, m) {

@@ -416,2 +417,17 @@ if (!Number.isInteger(n)) {

}
function gcd(a, b) {
if (!Number.isInteger(a) || a <= 0) {
throw new Error("Both numbers must be positive integers");
}
if (!Number.isInteger(b) || b <= 0) {
throw new Error("Both numbers must be positive integers");
}
let d;
do {
d = Math.abs(a - b);
a = Math.min(a, b);
b = d;
} while (d !== a && d > 0);
return d;
}
// Annotate the CommonJS export names for ESM import in node:

@@ -423,4 +439,5 @@ 0 && (module.exports = {

Vector,
gcd,
mod
});
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@rgsoft/math",
"version": "1.0.5",
"version": "1.0.6",
"description": "Yet another JS math library",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -249,2 +249,23 @@ # math-js

The `mod` function will fail if it receives a negative modulo or any non-integer
number.
number.
## Greatest Common Divisor
The `gcd` function calculates greatest common divisor between to positive
integers
```javascript
console.log(gcd(18, 4));
```
will ouput `2`.
## Least Common Multiple
The `lcm` function calculates least common multple between to positive integers
```javascript
console.log(lcm(18, 4));
```
will ouput `36`.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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