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
1
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.3 to 1.0.4

4

dist/index.d.ts

@@ -170,2 +170,4 @@ declare class Complex {

export { Complex, Line, Segment, Vector };
declare function mod(n: number, m: number): number;
export { Complex, Line, Segment, Vector, mod };

@@ -18,3 +18,3 @@ "use strict";

};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);

@@ -27,3 +27,4 @@ // src/index.ts

Segment: () => Segment,
Vector: () => Vector
Vector: () => Vector,
mod: () => mod
});

@@ -404,2 +405,19 @@ module.exports = __toCommonJS(src_exports);

};
// src/modulo.ts
function mod(n, m) {
if (!Number.isInteger(n)) {
throw new Error(`Non integer received: ${n}`);
}
if (!Number.isInteger(m)) {
throw new Error(`Non integer received: ${m}`);
}
if (m <= 0) {
throw new Error(`Modulo must be positive: ${m}`);
}
while (n < 0) {
n += m;
}
return n % m;
}
// Annotate the CommonJS export names for ESM import in node:

@@ -410,4 +428,5 @@ 0 && (module.exports = {

Segment,
Vector
Vector,
mod
});
//# sourceMappingURL=index.js.map
{
"name": "@rgsoft/math",
"version": "1.0.3",
"version": "1.0.4",
"description": "Yet another JS math library",

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

@@ -229,1 +229,22 @@ # math-js

```
## Modulo
The `mod` function calculates the modular remainder of a number `n` modulo `m`.
The main diference between this function and the remainder operator `%` is that
the `mod` function applies the modular arithmetic strictly. For example
```javascript
console.log(-1 % 4);
```
will output `-1`. Whereas using the `mod`:
```javascript
console.log(mod(-1, 4));
```
we should get `3`.
The `mod` function will fail if it receives a negative modulo or any non-integer
number.

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

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