## Functions
closestNumber(arr, num)number

Takes an array of numbers and finds the closest value to the given input number.

Inspired by https://github.com/andreruffert/closest-number

getRandomInt(min, max)number

Generates a random integer between the two specified values. The value is no lower than min and not equal to max (not inclusive). Do not use this for cryptography.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random

getRandomIntInclusive(min, max)number

Generates a random integer between the two specified values. The value is no lower than min and less than or equal to max (inclusive). Do not use this for cryptography.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random

getUUID(nodash)string

Retrieves a version 4 uuid. It can be with or without the dash characters.

isBrowser()

Checks the environment to see if it is running under a browser environment

isNode()

Checks the environment to see if it is running under nodejs. Note that this can be unreliable if "process" is globally defined in the environment by some other application (i.e. monkeypatching)

objFindKeyByValue(obj, val)

Searchs an objects value list to find its associated key. It will return the key of the first value found.

objHasValue(obj, val)

Searches an objects value list to see if it exists within the object. If a key contains that value, then it returns true, otherwise false.

roundUp(n, precision)

Rounds a number to its nearest precision

sanitize(buffer, verbose, log, encoding)

Takes a data buffer of output bytes, converts it to a string and then splits it on newlines for output. By default it is just saved into a sanitized array. If verbose is set to true, then the buffer it output to the console line by line.

## closestNumber(arr, num) ⇒ number Takes an array of numbers and finds the closest value to the given input number. Inspired by https://github.com/andreruffert/closest-number **Kind**: global function **Returns**: number - the number from arr that is closest to num **Params** - arr Array.<number> - array of numbers to search - num number - the number value used as a reference to find ## getRandomInt(min, max) ⇒ number Generates a random integer between the two specified values. The value is no lower than min and not equal to max (not inclusive). Do not use this for cryptography. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random **Kind**: global function **Returns**: number - a pseudo random number **Params** - min number - the smallest integer to use, inclusive - max number - the largest integer to use, non inclusive ## getRandomIntInclusive(min, max) ⇒ number Generates a random integer between the two specified values. The value is no lower than min and less than or equal to max (inclusive). Do not use this for cryptography. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random **Kind**: global function **Returns**: number - a pseudo random number **Params** - min number - the smallest integer to use, inclusive - max number - the largest integer to use, inclusive ## getUUID(nodash) ⇒ string Retrieves a version 4 uuid. It can be with or without the dash characters. **Kind**: global function **Returns**: string - a v4 uuid **Params** - nodash boolean - if true, the dashes are removed, otherwise just a v4 uuid is created. ## isBrowser() ⇒ Checks the environment to see if it is running under a browser environment **Kind**: global function **Returns**: true if the environment is the browser, otherwise false. ## isNode() ⇒ Checks the environment to see if it is running under nodejs. Note that this can be unreliable if "process" is globally defined in the environment by some other application (i.e. monkeypatching) **Kind**: global function **Returns**: true if the environment is running under node, otherwise false ## objFindKeyByValue(obj, val) ⇒ Searchs an objects value list to find its associated key. It will return the key of the first value found. **Kind**: global function **Returns**: the key/value pair, otherwise null **Params** - obj any - the object to search for a value - val any - the data to search for within the object ## objHasValue(obj, val) ⇒ Searches an objects value list to see if it exists within the object. If a key contains that value, then it returns true, otherwise false. **Kind**: global function **Returns**: true if the value is found otherwise false **Params** - obj any - the object to search for a value - val any - the data to search for within the object ## roundUp(n, precision) ⇒ Rounds a number to its nearest precision **Kind**: global function **Returns**: the newly rounded number **Params** - n number - the number to round - precision number - the number of decimal places to preserve ## sanitize(buffer, verbose, log, encoding) Takes a data buffer of output bytes, converts it to a string and then splits it on newlines for output. By default it is just saved into a sanitized array. If verbose is set to true, then the buffer it output to the console line by line. **Kind**: global function **Retuns**: string[] an array of string that represent the lines given with the input buffer. **Params** - buffer string | Buffer - the output bytes to convert and print to log. - verbose boolean = false - if true, then the sanitized output is sent to the console. - log console.log - the output logger to write the output when verbose. - encoding string = "\"utf8\"" - the encoding type for a buffer input type when it is coverted to a string.