encrypt

encrypt

new encrypt()

This is the main command for the mvc framework, that which all other commands extend

Methods

(private, static) checkIsFile()

Determine if the request was for a file with an extension

(private, static) cleanDuplicates(data)

Clean duplicates from an array

Parameters:
Name Type Description
data Array

The array of data to clean

(private, static) decrypt(value, key, callback)

AES decrypt a string with a key

Parameters:
Name Type Description
value String

The value to encrypt

key String

The secret key for the encryption

callback function

The callback function to execute when encryption is complete

(private, static) decrypt(value, key, callback)

AES encrypt a string with a key

Parameters:
Name Type Description
value String

The value to encrypt

key String

The secret key for the encryption

callback function

The callback function to execute when encryption is complete

(private, static) deserialize(string, delim)

Deserialize an object into a string

Parameters:
Name Type Description
string String

The string to deserialize into an object

delim String

The delimeter used in the string

(private, static) each(array, callback)

Loop through an array and execute a callback per item

Parameters:
Name Type Description
array Array

The array to perform actions on

callback function

The callback function to execute

(private, static) escapeString(string)

Escapes a string so that it can be used in regular expressions

Parameters:
Name Type Description
string String

The string to escape the characters for

(private, static) getCookie(name, callback)

Gets a cookie from a user machine

Parameters:
Name Type Description
name String

The name of the cookie to retrieve

callback function

The callback function to execute

(private, static) params(data)

Clean duplicates from an array

Parameters:
Name Type Description
data Array

The array of data to clean

(private, static) parseCookies({Array})

Parse the cookie information and retrieve the data for a specific cookie

Parameters:
Name Type Description
{Array} String

cookie

(private, static) prop(object, callback)

Perform an each action on a set of object properties

Parameters:
Name Type Description
object Object

The object to perform actions on

callback function

The callback function to execute

(private, static) random(min, max)

Generate a random number from max and min values

Parameters:
Name Type Description
min Number

The minimum value

max Number

The minimum value

Returns:
  • Returns a random number between the max and min values

(private, static) serialize(obj, delim)

Serialize an object into a string

Parameters:
Name Type Description
obj Object

The object to serialize into a string

delim String

The delimeter used in the string

(private, static) serializeCookie(name, value, options)

Serialize a Cookie into the required string format based on the options

Parameters:
Name Type Description
name String

The name of the cookie

value String

The value for the cookie

options Object

The options relating to the cookie maxAge, secure, httpOnly, domain, path, expires

(private, static) setCookie(object, callback)

Sets a cookie to a user machine

Parameters:
Name Type Description
object Object

The object to perform actions on

callback function

The callback function to execute

(private, static) shuffle(array)

Shuffles and array into a random order

Parameters:
Name Type Description
array Array

The array of data to shuffle

(private, static) sort(property, direction)

Sort and array by properties, ascending or descending

Parameters:
Name Type Description
property String

The property to sort by

direction String

The direction to sort in

(private, static) sortNumber(propery)

Sort numbers, ascending or descending

Parameters:
Name Type Description
propery String

The property to sort by

(private, static) uppercaseFirst(string)

Simple toCaps function, extract this to a utility file

Parameters:
Name Type Description
string String

The string to Capitalize