examples/dependencies/x-div/x-div.js
function processCondition(condition, errorMessage) {
  if (!condition) {
    var completeErrorMessage = '';
    var re = /at ([^\s]+)\s\(/g;
    var stackTrace = new Error().stack;
    var stackFunctions = [];

    var funcName = re.exec(stackTrace);
    while (funcName && funcName[1]) {
      stackFunctions.push(funcName[1]);
      funcName = re.exec(stackTrace);
    }

    // Number 0 is processCondition itself,
    // Number 1 is assert,
    // Number 2 is the caller function.
    if (stackFunctions[2]) {
      completeErrorMessage = stackFunctions[2] + ': ' + completeErrorMessage;
    }

    completeErrorMessage += errorMessage;
    return completeErrorMessage;
  }

  return null;
}
function processCondition(condition, errorMessage) {
  if (!condition) {
    var completeErrorMessage = '';
    var re = /at ([^\s]+)\s\(/g;
    var stackTrace = new Error().stack;
    var stackFunctions = [];

    var funcName = re.exec(stackTrace);
    while (funcName && funcName[1]) {
      stackFunctions.push(funcName[1]);
      funcName = re.exec(stackTrace);
    }

    // Number 0 is processCondition itself,
    // Number 1 is assert,
    // Number 2 is the caller function.
    if (stackFunctions[2]) {
      completeErrorMessage = stackFunctions[2] + ': ' + completeErrorMessage;
    }

    completeErrorMessage += errorMessage;
    return completeErrorMessage;
  }

  return null;
}
function processCondition ( condition , errorMessage ) { if ( ! condition ) { var completeErrorMessage = '' ; var re = / at ([^\s]+)\s\( / g ; var stackTrace = new Error ( ) . stack ; var stackFunctions = [ ] ; var funcName = re . exec ( stackTrace ) ; while ( funcName && funcName [ 1 ] ) { stackFunctions . push ( funcName [ 1 ] ) ; funcName = re . exec ( stackTrace ) ; } // Number 0 is processCondition itself, // Number 1 is assert, // Number 2 is the caller function. if ( stackFunctions [ 2 ] ) { completeErrorMessage = stackFunctions [ 2 ] + ': ' + completeErrorMessage ; } completeErrorMessage += errorMessage ; return completeErrorMessage ; } return null ; }
Bug checking function that will throw an error whenever the condition sent to it is evaluated to false 
Processes the message and outputs the correct message if the condition
is false. Otherwise it outputs null.
@api private
@method processCondition
@param  {Boolean} condition - Result of the evaluated condition
@param  {String} errorMessage - Message explainig the error in case it is thrown
@return {String | null}  - Error message if there is an error, nul otherwise.
Bug checking function that will throw an error whenever the condition sent to it is evaluated to false Processes the message and outputs the correct message if the condition is false . Otherwise it outputs null .