bettertools-js
v1.0.3
Published
Some Small js function to make it easy to work
Readme
BetterTools
Some basic tools to make your project easier and better! All of the function are not dependent for each other and can run by it self. That mean you can just copy the code of one of the function that you need without downloading all the function. And some will have comments to explain how it works
Setup
First Run
git clone https://github.com/GamerXR-637/BetterTools-js.gitin you terminal or download the file BetterTools
Second, in your main file, add:
const "name" = require("File Path to the "BetterTools" folder");
// Name can be anything
//or
const { "Functions you want to use" } = require("File Path to the "BetterTools" folder");
// This is better to allow you to use only certain functions
// [See at the end for a list of function]npm
npm i bettertools-jsconst { FunctionName } = require("bettertools-js/BetterTools");
// or
const "name" = require("bettertools-js/BetterTools");
List of Function
If you use the first option, then the function should be called as Due to you are using this option you are importing all the function.
"name".FunctionName(parameters)Else, this works fine with the second option You will be importing the function that you only need
FunctionName(parameters)
// Only the function that you are callingExamples and Usage
betterUUID(number)
// betterUUID(number)
// Allows you to have a custom-made UUID based on your needs
// Input: Number how many sections to have ( Default: 3 )
let uuid = betterUUID()
console.log(uuid)
// Output: 7Uyzvv-ZXhsvFp-K9025qqGPGRandcolor(number, hash)
// Randcolor(number, hash)
// Allows you to get any amount of random colors with the # or out
// Input:
// number / how many color to be returned ( Default: 1 )
// hash / True or False
let color = Randcolor(3, true)
console.log(color)
// Output: #eba3b5,#5c9f33,#4c7bd5
let color_no_hash = Randcolor(3, false)
console.log(color_no_hash)
// Output: eba3b5,5c9f33,4c7bd5seededRandom(seed)
console.log(seededRandom(37))
// Will return 0.0002615799930373639Functions Names
Math
cylinderVolume - Calculate the volume of a cylinder | Input: [radius (Default: 3), pi (Default: true), hight (Default: 2)] multiplyPoly - Calculate the product of 2 polynomials | Input: [poly1 (Array), poly2 (Array)] pointSlope - Calculate the y=mx+b formula from 2 point | Input: [x1, y1, x2, y2] circleArea - Calculate the area of a circle | Input: [radius (Default: 3), pi (Default: true)] randomInt - Get a random Integer | Input: [number (Default: 10)] quadratic - Get the zeros of a quadratic formula | Input: [a (Default: 1), b (Default: 4), c (Default: 3)] triangle - Calculate the area of a triangle | Input: [legOne (Default: 3), legTwo (Default: 4)] average - Calculate the average of a array | Input: [numbers (Array)] inRange - Get if a number is in range | Input: [x (Default: 0), y (Default: 10), value (Default: 1)] percent - Calculate the percentage of a ratio | Input: [numerator (Default: 3), denominator (Default: 4)] median - Calculate the median of a array | Input: [numbers (Array)] pointY - Calculates where the p0int is when y = n | Input: [x (Default: 3), y (Default: 4), n (Default: 1)] pointX - Calculates where the p0int is when x = n | Input: [x (Default: 3), y (Default: 4), n (Default: 1)] temp - Calculate the temperature conversion | Input: [n, from, to]
Text
binary - Turn text into Binary | Input: [text] morseCode - Turn text into Morse Code | Input: [text] truncate - Cut the text with "..." | Input: [text, number (Default: 5)]
Tools
colorTerminal -> Logs in color | Input: [text, color] seededRandom -> Get a random number based on a seed | Input: [seed (Default: 37)] seededRandom -> Get a random number based on a seed with Math.random() | Input: [seed (Default: 37)] betterUUID -> Create a custom UUID | Input: [number (Default: 3)] Randcolor -> Get random color | Input: [number (Default: 1), hash (Default: true)] rgbtohex -> Convert RGB to Hex | Input: [r, g, b] sleep -> Cause a the code to pause for n | Input: [seconds (Default: 10)]
Useless
cat - Just Cat | Input: [text] load - Create a loading sign | Input: [message, n]
