Mixin: Common

Common

Provides commonly used methods to most classes in ForerunnerDB.
Source:

Members

(static) debug

Sets debug flag for a particular type that can enable debug message output to the console if required.
Source:

Methods

(static) classIdentifier() → {string}

Returns a string describing the class this instance is derived from.
Source:
Returns:
Type
string

(static) convertToFdb(obj)

Converts a query object with MongoDB dot notation syntax to Forerunner's object notation syntax.
Parameters:
Name Type Description
obj Object The object to convert.
Source:

(static) decouple(data, copiesopt) → {*}

Returns a non-referenced version of the passed object / array.
Parameters:
Name Type Attributes Description
data Object The object or array to return as a non-referenced version.
copies Number <optional>
Optional number of copies to produce. If specified, the return value will be an array of decoupled objects, each distinct from the other.
Source:
Returns:
Type
*

(static) instanceIdentifier() → {String}

Returns a string describing the instance by it's class name and instance object name.
Source:
Returns:
The instance identifier.
Type
String

(static) isDropped() → {boolean}

Checks if the state is dropped.
Source:
Returns:
True when dropped, false otherwise.
Type
boolean

(static) jParse(data) → {Object}

Parses and returns data from stringified version.
Parameters:
Name Type Description
data String The stringified version of data to parse.
Source:
Returns:
The parsed JSON object from the data.
Type
Object

(static) jStringify(data) → {String}

Converts a JSON object into a stringified version.
Parameters:
Name Type Description
data Object The data to stringify.
Source:
Returns:
The stringified data.
Type
String

(static) logIdentifier() → {string}

Returns a string used to denote a console log against this instance, consisting of the class identifier and instance identifier.
Source:
Returns:
The log identifier.
Type
string

(static) objectId(stropt) → {String}

Generates a new 16-character hexadecimal unique ID or generates a new 16-character hexadecimal ID based on the passed string. Will always generate the same ID for the same string.
Parameters:
Name Type Attributes Description
str String <optional>
A string to generate the ID from.
Source:
Returns:
Type
String

(static) store(key, valopt) → {*}

Gets / sets data in the item store. The store can be used to set and retrieve data against a key. Useful for adding arbitrary key/value data to a collection / view etc and retrieving it later.
Parameters:
Name Type Attributes Description
key String | * The key under which to store the passed value or retrieve the existing stored value.
val * <optional>
Optional value. If passed will overwrite the existing value stored against the specified key if one currently exists.
Source:
Returns:
Type
*

(static) unStore(key) → {Common}

Removes a previously stored key/value pair from the item store, set previously by using the store() method.
Parameters:
Name Type Description
key String | * The key of the key/value pair to remove;
Source:
Returns:
Returns this for chaining.
Type
Common