Namespace: util

apogee.util

This namespace includes some utility functions available to the user.

Members

(static) INVALID_VALUE

This value can be assigned to a data table to signify that data is not valid.
Any other member depending on this value will withhold the calcalation and also
return this invalid value.

Methods

(static) formatString(format, stringArgs) → {String}

This method does format string functionality. Text should include
{i} to insert the ith string argument passed.

Parameters:
Name Type Description
format String

This is a format string to format the output.

stringArgs Array

These are the values which should be placed into the format string.

Returns:

The format string with the proper inserted values is returned.

Type
String

(static) getNormalizedCopy(json1) → {Boolean}

This method returns a copied json that has the order in all JSON objects/"maps" normalized to alphabetical.
The order of JSON arrays is NOT modified.
This is intended for the purpose of comparing json objects.

Parameters:
Name Type Description
json1 JSON

This is a JSON valued object

Returns:
  • Returns whether or not the objects are equal
Type
Boolean

(static) getObjectType(object) → {String}

This method returns the object type. The Allowed types are:
String, Number, Boolean, Date, Object, Array, Function, null, undefined.

Parameters:
Name Type Description
object Object

This is the object for which the type is desired.

Returns:

This is the type for the object.

Type
String

(static) invalidFunctionReturn()

This function should be called from the body of a function table
to indicate the function will not return a valid value. (The actual invalid value
can not be returned since this typically will not have the desired effect.)

(static) jsonCopy(data) → {JSON}

This method creates a deep copy of an object, array or value. Note that
undefined is not a valid value in JSON.

Parameters:
Name Type Description
data JSON

This is a JSON valued object

Returns:

A JSON object which is a deep copy of the input.

Type
JSON

(static) jsonEquals(json1, json1) → {Boolean}

This is a not-so-efficient equals for json objects. For JSON objects it
does not require order matching of the keys. For JSON arrays it does require
order matching of the array values.

Parameters:
Name Type Description
json1 JSON

This is a JSON valued object

json1 JSON

This is a JSON valued object

Returns:
  • Returns whether or not the objects are equal
Type
Boolean

(static) objectHash(object) → {integer}

This method creates an integer hash value for a JSON object.

Parameters:
Name Type Description
object JSON

This is the json valued object for which a hash number is desired.

Returns:

This is the hash value for the JSON.

Type
integer

(static) readQueryField(field, url) → {String}

This method reads the query string from a url

Parameters:
Name Type Description
field String

This is the field that should be read from the url query string

url String

This is the url from which we read the query string

Returns:

The value associated with the query string key passed in.

Type
String

(static) stringHash(string) → {integer}

This method creates an integer hash value for a string.

Parameters:
Name Type Description
string String

This is the string for which a hash number is desired.

Returns:

This is the hash value for the string.

Type
integer