Registry / math / pythagore

pythagore

JSON →
library2.3.0jsnpmunverified

A JavaScript library for calculating the Pythagorean theorem, version 2.3.0. It provides a class-based API with methods to compute the hypotenuse, adjacent side, and check if a triangle is right-angled. The library supports both object-oriented and functional usage, but it is not actively maintained and lacks ES module support. It is limited to basic trigonometric operations and uses CommonJS syntax, making it suitable only for Node.js environments without modern bundler integration.

npm install pythagore
INSTALL
IMPORT
SIG · PYTHAGORE
P
pythagore
mathjavascriptv2.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Pythagore
✓ const Pythagore = require('pythagore');
✗ import Pythagore from 'pythagore';
Package uses CommonJS; no default export for ES modules.
instance methods
✓ const p = new Pythagore(); p.Hypotenus(3,4);
✗ Pythagore.Hypotenus(3,4);
Methods are instance methods, not static. Must instantiate first.
minified version
✓ const Pythagore = require('pythagore/Pythagore.min.js');
✗ require('pythagore');
Main entry in package.json may point to non-minified version; minified avoids potential issues.

Demonstrates creating a Pythagore instance and using its three main methods for hypotenuse, adjacent side, and right triangle verification.

const Pythagore = require('pythagore'); const p = new Pythagore(); // Calculate hypotenuse const hyp = p.Hypotenus(3, 4); console.log('Hypotenuse:', hyp); // 5 // Check if triangle is right-angled const isRight = p.IsRectangle(5, 3, 4); console.log('Is right triangle?', isRight); // true // Calculate adjacent side const adj = p.AdjacentSide(5, 3); console.log('Adjacent side:', adj); // 4 // Use constructor parameters const p2 = new Pythagore(3, 4, 5); console.log('Hypotenuse:', p2.Hypotenus()); // 5
Debug
Known issues
gotchaMethods must be called on an instance; they are not static.
fix
Instantiate with `new Pythagore()` before calling methods.
affects: >=1.0.0
gotchaConstructor parameters override later method arguments; calling a method with no arguments uses stored values.
fix
Always pass explicit arguments to methods or ensure constructor values are intended for reuse.
affects: >=1.0.0
gotchaMethod names are case-sensitive and non-standard (e.g., 'Hypotenus' instead of 'Hypotenuse').
fix
Use exact method names: Hypotenus, AdjacentSide, IsRectangle, Author.
affects: >=1.0.0
gotchaNo error handling for invalid input (e.g., negative numbers).
fix
Validate inputs before passing to methods.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Pythagore.Hypotenus is not a function
Calling method on the class instead of an instance.
fix
Create an instance first: const p = new Pythagore(); p.Hypotenus(3,4);
Cannot find module 'pythagore'
Package not installed or wrong import path in ES module context.
fix
Run `npm install pythagore` and use `const Pythagore = require('pythagore');`
TypeError: p.IsRectangle is not a function
Method name typo (e.g., 'IsRectangLe' vs 'IsRectangle').
fix
Use correct capitalization: IsRectangle, Hypotenus, AdjacentSide.
Upgrade
Version history
2.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
pythagore — npm install pythagore · libregistry