npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

geometry_ltwo

v2.0.0

Published

Geometry module

Readme

Geometry module

This is a geometry module that helps you calculate different calculations on a right-angled triangle, rectangle and circle. It helps you calculate the area and perimeter.
On the right-angled triangle it also helps you calculate the angles and sides. For all three shapes you can increase or decrease the area by a percentage and get the new measurements for the different sides.

Installation

npm install geometry_ltwo
or
clone this repository from github and copy the src-folder into your code

Usage

To use the module you import the class you want to use (Circle, Rectangle or RightAngledTriangle) and make a new object of it, you set the known properties and call the function you want to use.
Se example below.

Example

Circle

Properties

radius
diameter

Functions

getArea()
Returns the area, needs the radius property.

getCircumferenceWithRadius()
Returns the circumference, needs the radius property.

getCircumferenceWithDiameter()
Returns the circumference, needs the diameter property.

increaseOrDecreaseByPercent()
Sets the new property measurments to increase the percentage by the percent being sent in to the function.
Needs the radius property.

Rectangle

Properties

length
width

Functions

getArea()
Returns the perimeter, needs the length and width properties.

getPerimeter()
Returns the perimeter, needs the length and width properties.

increaseOrDecreaseByPercent()
Sets the new property measurments to increase the percentage by the percent being sent in to the function.
Needs the length and width properties.

RightAngledTriangle

Properties

hypotenuse
adjacentSide
oppositeSide
adjacentAngle
oppositeAngle
angle = 90 (already set)

To call the functions correctly, it is important to know which property is which.
See picture below to understand their locations.

Triangle

Functions

getArea()
Returns the area, needs the hypotenuse, adjacentSide and oppositeSide properties.

getPerimeter()
Returns the perimeter, needs the hypotenuse, adjacentSide and oppositeSide properties.

getHypotenuse()
Returns the hypotenuse, needs the adjacentSide and oppositeSide properties.

getOppositeSide()
Returns the oppositeSide, needs the adjacentSide and the hypotenuse properties.

getAdjacentSide()
Returns the adjacentSide, needs the oppositeSide and the hypotenuse properties.

getOppositeAngle()
Returns the oppositeAngle, needs the adjacentAngle property.

getAdjacentAngle()
Returns the adjacentAngle, needs the oppositeAngle property.

getAdjacentSideWithAngle()
Returns the adjacentSide, needs the adjacentAngle and the hypotenuse properties.

getHypotenuseWithAngle()
Returns the hypotenuse, needs the adjacentAngle and the adjacentSide properties.

getAdjacentAngleWithSide()
Returns the adjacentAngle, needs the adjacentSide and the hypotenuse properties.

getOppositeAngleWithSide()
Returns the oppositeAngle, needs the oppositeSide and the hypotenuse properties.

increaseOrDecreaseByPercent()
Sets the new property measurments to increase the percentage by the percent being sent in to the function.
Needs the hypotenuse, adjacentSide and oppositeSide properties.

Contributing

Feel free to contribute, for any questions, email [email protected]

License

MIT License

Copyright (c) 2024 Anna Ståhlberg

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.