Noodles Practicing Medicine

# npm

Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

## gg-utils

0.2.2 • Public • Published

# GG Utils

GG Utils collects utils for daily struggle

## API Reference

### Algorithm

bubbleSort(array)

Sorts an array from the minimum to the maximum.

cocktailShakerSort(array)

Sorts an array from the minimum to the maximum.

combSort(array)

Sorts an array from the minimum to the maximum.

Reference: https://en.wikipedia.org/wiki/Comb_sort

fibonacciNumber(n)

Returns the nth fibonacci number.

fibonacciNumberRecursive(n)

Returns the nth fibonacci number using the recursive algorithm (slower than the iterative).

gnomeSort(array)

Sorts an array from the minimum to the maximum.

Reference: https://en.wikipedia.org/wiki/Gnome_sort

quickSort(array)

Sorts an array from the minimum to the maximum.

Reference: https://en.wikipedia.org/wiki/Quicksort

sieveOfEratosthenes(n)

Produces an array with all primes not greater than n.

trialDivision(n)

Produces an array with prime factors of n.

### Date

isLeapYear(year)

Checks if year is a leap year.

Reference: https://en.wikipedia.org/wiki/Leap_year

timeDiff(from, to[,timezone])

Returns an object with the fields: days, hours, minutes and seconds of the time difference between from and to

### Network

Checks if the string provided is a valid MAC address.

isIPV4(IPV4)

Checks if the string provided is a valid IPV4.

isIPV6(IPV6[,specialCheck])

Checks if the string provided is a valid IPV6. If specialCheck is true (default is false), the following IPV6 address will be treated as valid:

• ::/128
• ::1/128
• ::/96
• ::ffff:0:0/96
• fe80::/10
• fec0::/10
• fc00::/7
• ff00::/8"

simplifyIPV6(IPV6)

Simpliefies a valid IPV6.

### Random

arrayGeneratorInt(min,max,n)

Returns a random array of integers.

• min is minimum value
• max is the maximum value
• n is the size of the array (limit 10000000)

getRandomIntInclusive(min,max)

Returns a random integer between min and max (both inclusive)

getRandomString(n)

Returns a random string with length n. Available chars are [a-zA-Z0-9].

MIT

## Keywords

### Install

npm i gg-utils

0

0.2.2

MIT

### Homepage

github.com/ItHurts/ggutils

### Repository

github.com/ItHurts/ggutils