Namespace: dev

dev

Version:
  • 1.0
Since:
  • 23/10/2020
Author:
  • Brennan Wilkes
Source:

Classes

DrinkRecipe

Methods

(static) dateWrap(dateStr) → {string}

Wraps a date sting with the SQL date() function
Parameters:
Name Type Description
dateStr string Date string to wrap
Source:
Returns:
Date wrapped in date() function
Type
string

(static) dateYMD(dateObj) → {string}

Converts a date object into a formatted string
Parameters:
Name Type Description
dateObj date JS Date object to format
Source:
Returns:
Date in the format YYYY/MM/DD
Type
string

(static) randomDate(start, end) → {date}

Generates a random date between two dates
Parameters:
Name Type Description
start date Initial date
end date Max date
Source:
Returns:
Random date btween start and end
Type
date

(static) roundQ(num) → {number}

Rounds a number to the nearest quarter
Parameters:
Name Type Description
num number Number to round
Source:
Returns:
num rounded to nearest quarter
Type
number

(static) splitTupleJSON(json) → {object}

Splits a SQL tuple in JSON form into columns and data strings
Parameters:
Name Type Description
json object SQL tuple in JSON form
Source:
Returns:
column/data string tuple form.
Type
object

(static) strWrap(val) → {string}

Wraps a string in quotes if it does not begin with "date" and is a string type. Intended to prepare data for SQL injection.
Parameters:
Name Type Description
val string String to check and wrap
Source:
Returns:
val potentially wrapped in quotes
Type
string