HTML and CSS Reference
In-Depth Information
// Some base options to be filled in later
Q.options = {
// TODO: set some sensible defaults
if(opts) { _(Q.options).extend(opts); }
Q._normalizeArg = function(arg) {
if(_.isString(arg)) {
arg = arg.replace(/\s+/g,'').split(",");
if(!_.isArray(arg)) {
arg = [ arg ];
return arg;
// Shortcut to extend Quintus with new functionality
// binding the methods to Q
Q.extend = function(obj) {
return Q;
// Syntax for including other modules into quintus
Q.include = function(mod) {
_.each(Q._normalizeArg(mod),function(m) {
m = Quintus[m] || m;
return Q;
// TODO: Additional Quintus Code goes here
return Q;
This initial code provides the base for the modular architecture that the rest of the engine will be built on.
The main thing the code does is create an options object and extend that object with any additional passed-in
options in opts .
Continuing through the code, you can use the _normalizeArg method to take a string of passed-in,
comma-separated names and turn them into an array of names with any whitespace stripped out. This conveni-
ence method enables you to write, for example, "sword, shield, health" instead of ["sword",
"shield", "health"] . If you pass in an array then, that array of elements is used without transformation.
_normalizeArg is used in case a list of includes are passed in.
Search WWH ::

Custom Search