1.0.0 • Published 4 years ago

@samfuller01/tiny v1.0.0

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

tiny

npm (scoped) Build Status

Tiny Logo

This is a super tiny(heh, get it?) JavaScript package designed to make simple calculations very easy. It also allows you to perform basic mathematical operations on shapes.

Installation

npm installation: npm install @samfuller01/tiny

yarn installation: yarn add @samfuller01/tiny

Documentation

add

Add two numbers passed in as parameters together and returns that value.

tiny.add(5, 5); // Returns 10

subtract

Subtracts two numbers passed in as parameters and returns that value.

tiny.subtract(10, 5); // Returns 5

multiply

Multiplies two numbers passed in as parameters together and returns that value.

tiny.multiply(5, 5); // Returns 25

divide

Divides two numbers passed in and returns that value.

NOTE: The first number passed in is divided by the second.

tiny.divide(10, 5); // Returns 2

modulo

Returns the result of a modulo operation with the two numbers you passed in.

tiny.modulo(5, 5); // Returns 0

sin

Returns the sine of the number passed in.

tiny.sin(5); // Returns -0.9589242746631385

cos

Returns the cosine of the number passed in.

tiny.cos(5); // Returns 0.28366218546322625

tan

Returns the tangent of the number passed in.

tiny.tan(5); // Returns -3.380515006246586

absoluteValue

Returns the absolute value of a number passed in.

tiny.absoluteValue(-5); // Returns 5

Circle

Circle is a class that contains numerous calculations relating to circles. All the functions accept one parameter: the radius.

const tiny = require('@samfuller/tiny');
const circle = new tiny.Circle;

circle.area(5); // Returns 78.53981633974483
circle.perimeter(5); // Returns 31.41592653589793
circle.diameter(5); // Returns 10

Square

Square is a class that contains numerous calculations relating to squares. All functions accept one parameter: the side length.

const tiny = require('@samfuller/tiny');
const square = new tiny.Square;

square.area(5); // Returns 25
square.perimeter(5); // Returns 20
square.diagonal(5); // Returns 7.0710678118654755

Rectangle

Rectangle is a class that contains numerous calculations relating to rectangles. All functions accept two parameters: side length and side width.

const tiny = require('@samfuller/tiny');
const rectangle = new tiny.Rectangle;

rectangle.area(5, 10); // Returns 50
rectangle.perimeter(5, 10); // Returns 30
rectangle.diagonal(5, 10); // Returns 11.180339887498949

Triangle

Triangle is a class that contains numerous calcualtions relating to triangles. The parameters depends on which function is being used.

NOTE: The area function accepts two parameters: The base and height of the triangle. The perimeter function accepts three parameters: All three side lengths.

const tiny = require('@samfuller/tiny');
const triangle = new tiny.Triangle;

triangle.area(5, 10); // Returns 25
triangle.perimeter(5, 10, 15); // Returns 30

License

This project is available under the MIT license.

Attribution

Logo attribution: 3d vector created by rawpixel.com - www.freepik.com

1.0.0

4 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago