stahr-tools
Advanced tools
Comparing version 1.3.1 to 1.4.0
31
index.js
@@ -85,2 +85,8 @@ // Developer Functions (to make sure the module is working) | ||
}, | ||
RandomInteger: function(min, max) { | ||
return Math.floor(min, max) * 10 | ||
} | ||
@@ -140,28 +146,25 @@ | ||
Prism : function(height, width, length) { | ||
Prism : function (height, width, length) { | ||
return height * width * length; | ||
return height * width * length; | ||
}, | ||
Cylinder: function (radius, height) { | ||
Cylinder : function(radius, height) { | ||
return Math.PI * Math.pow(radius, 2) * 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) { | ||
Sphere : function(radius) { | ||
return (1 / 3) * Math.PI * Math.pow(radius, 2) * height; | ||
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.3.1", | ||
"version": "1.4.0", | ||
"description": "A simple lightweight package for array manipulation, string tools, and advanced math for Node.js", | ||
@@ -26,3 +26,4 @@ "main": "release.min.js", | ||
"perimeter", | ||
"3d" | ||
"3d", | ||
"random" | ||
], | ||
@@ -29,0 +30,0 @@ "author": "grantstahr", |
@@ -27,20 +27,2 @@ # 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 | ||
@@ -107,2 +89,1 @@ | ||
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.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}}; | ||
exports.TestFunction=function(){return"Module is working!"},exports.Version=function(){return"1.0.0"},exports.Author=function(){return"Grant Stahr"},exports.StringTools={ReverseString:function(r){return r.split("").reverse().join("")},ToCaps:function(r){return r.toUpperCase()},ToLower:function(r){return r.toLowerCase()},ToCharArray:function(r){return r.split("")}},exports.NumberTools={Add:function(r,n){return r+n},Subtract:function(r,n){return r-n},Multiply:function(r,n){return r*n},Divide:function(r,n){return r/n},SquareRoot:function(r){return Math.sqrt(r)},Power:function(r,n){return Math.pow(r,n)},RandomInteger:function(r,n){return 10*Math.floor(r,n)}},exports.ArrayTools={ReverseArray:function(r){return r.reverse()},SortArray:function(r){return r.sort()},ShuffleArray:function(r){return r.sort(()=>Math.random()-.5)},RemoveDuplicates:function(r){return r.filter((n,t)=>r.indexOf(n)===t)},GetRandomItem:function(r){return r[Math.floor(Math.random()*r.length)]},GetRandomItems:function(r,n){let t=[];for(let o=0;o<n;o++)t.push(r[Math.floor(Math.random()*r.length)]);return t}},exports.ShapeTools={Prism:function(r,n,t){return r*n*t},Cylinder:function(r,n){return Math.PI*Math.pow(r,2)*n},Sphere:function(r){return 4/3*Math.PI*Math.pow(r,3)},Cone:function(r,n){return 1/3*Math.PI*Math.pow(r,2)*n}}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85
6194
88