stahr-tools
Advanced tools
Comparing version 1.2.0 to 1.3.1
28
index.js
@@ -137,2 +137,30 @@ // Developer Functions (to make sure the module is working) | ||
exports.ShapeTools = { | ||
Prism : function(height, width, length) { | ||
return height * width * length; | ||
}, | ||
Cylinder : function(radius, height) { | ||
return Math.PI * Math.pow(radius, 2) * height; | ||
}, | ||
Sphere : function(radius) { | ||
return (4 / 3) * Math.PI * Math.pow(radius, 3); | ||
}, | ||
Cone : function(radius, height) { | ||
return (1 / 3) * Math.PI * Math.pow(radius, 2) * height; | ||
} | ||
} | ||
// Path: index.js |
{ | ||
"name": "stahr-tools", | ||
"version": "1.2.0", | ||
"version": "1.3.1", | ||
"description": "A simple lightweight package for array manipulation, string tools, and advanced math for Node.js", | ||
@@ -22,3 +22,7 @@ "main": "release.min.js", | ||
"stahr-tools", | ||
"stahrtools" | ||
"stahrtools", | ||
"area", | ||
"volume", | ||
"perimeter", | ||
"3d" | ||
], | ||
@@ -25,0 +29,0 @@ "author": "grantstahr", |
@@ -27,2 +27,20 @@ # Stahr Tools | ||
## Shape Functions | ||
### `ShapeTools.Prism(width, height, depth)` | ||
Returns the volume of a prism. | ||
### `ShapeTools.Cylinder(radius, height)` | ||
Returns the volume of a cylinder. | ||
### `ShapeTools.Cone(radius, height)` | ||
Returns the volume of a cone. | ||
### `ShapeTools.Sphere(radius)` | ||
Returns the volume of a sphere. | ||
## Number Functions | ||
@@ -89,1 +107,2 @@ | ||
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. | ||
https://github.com/InsulatorGMan/stahr-tools |
@@ -1,1 +0,1 @@ | ||
exports.TestFunction=function(){return"Module is working!"},exports.Version=function(){return"1.0.0"},exports.Author=function(){return"Grant Stahr"},exports.StringTools={ReverseString:function(str){return str.split("").reverse().join("")},ToCaps:function(str){return str.toUpperCase()},ToLower:function(str){return str.toLowerCase()},ToCharArray:function(str){return str.split("")}},exports.NumberTools={Add:function(num1,num2){return num1+num2},Subtract:function(num1,num2){return num1-num2},Multiply:function(num1,num2){return num1*num2},Divide:function(num1,num2){return num1/num2},SquareRoot:function(num){return Math.sqrt(num)},Power:function(num,power){return Math.pow(num,power)}},exports.ArrayTools={ReverseArray:function(arr){return arr.reverse()},SortArray:function(arr){return arr.sort()},ShuffleArray:function(arr){return arr.sort(()=>Math.random()-.5)},RemoveDuplicates:function(arr){return arr.filter((item,index)=>arr.indexOf(item)===index)},GetRandomItem:function(arr){return arr[Math.floor(Math.random()*arr.length)]},GetRandomItems:function(arr,num){let randomItems=[];for(let i=0;i<num;i++)randomItems.push(arr[Math.floor(Math.random()*arr.length)]);return randomItems}}; | ||
exports.TestFunction=function(){return"Module is working!"},exports.Version=function(){return"1.0.0"},exports.Author=function(){return"Grant Stahr"},exports.StringTools={ReverseString:function(str){return str.split("").reverse().join("")},ToCaps:function(str){return str.toUpperCase()},ToLower:function(str){return str.toLowerCase()},ToCharArray:function(str){return str.split("")}},exports.NumberTools={Add:function(num1,num2){return num1+num2},Subtract:function(num1,num2){return num1-num2},Multiply:function(num1,num2){return num1*num2},Divide:function(num1,num2){return num1/num2},SquareRoot:function(num){return Math.sqrt(num)},Power:function(num,power){return Math.pow(num,power)}},exports.ArrayTools={ReverseArray:function(arr){return arr.reverse()},SortArray:function(arr){return arr.sort()},ShuffleArray:function(arr){return arr.sort(()=>Math.random()-.5)},RemoveDuplicates:function(arr){return arr.filter((item,index)=>arr.indexOf(item)===index)},GetRandomItem:function(arr){return arr[Math.floor(Math.random()*arr.length)]},GetRandomItems:function(arr,num){let randomItems=[];for(let i=0;i<num;i++)randomItems.push(arr[Math.floor(Math.random()*arr.length)]);return randomItems}},exports.ShapeTools={Prism:function(height,width,length){return height*width*length},Cylinder:function(radius,height){return Math.PI*Math.pow(radius,2)*height},Sphere:function(radius){return 4/3*Math.PI*Math.pow(radius,3)},Cone:function(radius,height){return 1/3*Math.PI*Math.pow(radius,2)*height}}; |
6610
82
106