Socket
Socket
Sign inDemoInstall

stahr-tools

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.0 to 1.4.1

22

index.js

@@ -1,21 +0,5 @@

// Developer Functions (to make sure the module is working)
exports.WaitAsync = async function(ms) {
await new Promise(resolve => setTimeout(resolve, ms));
}
exports.TestFunction = function() {
return 'Module is working!';
};
exports.Version = function() {
return '1.0.0';
};
exports.Author = function() {
return 'Grant Stahr';
};
exports.StringTools = {

@@ -22,0 +6,0 @@

5

package.json
{
"name": "stahr-tools",
"version": "1.4.0",
"version": "1.4.1",
"description": "A simple lightweight package for array manipulation, string tools, and advanced math for Node.js",

@@ -27,3 +27,4 @@ "main": "release.min.js",

"3d",
"random"
"random",
"wait"
],

@@ -30,0 +31,0 @@ "author": "grantstahr",

# Stahr Tools
## New to 1.4.1 (2022-10-20)
```diff
+ Added: `WaitAsync` function
- Removed: Testing functions
= Github Repo listed at the bottom of the README
```
This is a collection of functions that I use in my projects. I have been using them for a while and I decided to put them in a separate package.

@@ -4,0 +12,0 @@ I hope you find them useful.

@@ -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(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}};
exports.WaitAsync=async function(ms){await new Promise(resolve=>setTimeout(resolve,ms))},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)},RandomInteger:function(min,max){return 10*Math.floor(min,max)}},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}};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc