https://github.com/nhsz/rectangle-area
Get the area of a rectangle, given the length and width
https://github.com/nhsz/rectangle-area
area geometry math nodejs npm npm-package polygons rectangle rectangle-area
Last synced: 6 months ago
JSON representation
Get the area of a rectangle, given the length and width
- Host: GitHub
- URL: https://github.com/nhsz/rectangle-area
- Owner: nhsz
- License: mit
- Created: 2017-06-02T16:31:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-03T17:01:54.000Z (over 8 years ago)
- Last Synced: 2025-03-18T13:28:46.295Z (7 months ago)
- Topics: area, geometry, math, nodejs, npm, npm-package, polygons, rectangle, rectangle-area
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/rectangle-area
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rectangle-area
[](https://nodei.co/npm/rectangle-area/)
> Get the **[`area of a rectangle`](https://en.wikipedia.org/wiki/Rectangle#Formulae)**, given the length and width
## Install
```
$ npm install --save rectangle-area
```## Usage
```js
const rectangleArea = require('rectangle-area')console.log(rectangleArea(2.5, 4.37))
// => 10.925console.log(rectangleArea(1, 1))
// => 1console.log(rectangleArea(3, Math.PI))
// => 9.42477796076938console.log(rectangleArea(0, 78))
// => Error: Invalid input. Sides of the rectangle must be greater than 0console.log(rectangleArea(1, -1))
// => Error: Invalid input. Sides of the rectangle must be greater than 0
```## License
MIT © **[`Nicolás Quiroz`](https://nicolasquiroz.com)**