### nodeGameBasic

Checks whether the basic dependencies of nodeGame are satisfied

@param {function} result The asynchronous result function

@return {array} Array of synchronous errors
334886
function(result) {
        var errors, db;
        errors = [];

        if ('undefined' === typeof NDDB) {
            errors.push('NDDB not found.');
        }

        if ('undefined' === typeof JSUS) {
            errors.push('JSUS not found.');
        }

        if ('undefined' === typeof J) {
            errors.push('J not found.');
        }

        if ('undefined' === typeof node.window) {
            errors.push('node.window not found.');
        }

        if ('undefined' === typeof W) {
            errors.push('W not found.');
        }

        if ('undefined' === typeof node.widgets) {
            errors.push('node.widgets not found.');
        }

        if ('undefined' !== typeof NDDB) {
            try {
                db = new NDDB();
            }
            catch(e) {
                errors.push('An error occurred manipulating the NDDB object: ' +
                            e.message);
            }
        }

        // We need to test node.Stager because it will be used in other tests.
        if ('undefined' === typeof node.Stager) {
            errors.push('node.Stager not found.');
        }

        return { success: !errors.length, errors: errors };
    }
440282
function(err, result) {
      if (err && !util.isError(err)) {
        err = new Error(err);
      }
      if (callback) callback(err, result);
    }
1261422
function handleUniqueResult(results) {
      var res = [], flag = {};
      for (var i = 0; i<results.length; i++) {
        if (flag[results[i][self.displayProperty1]]) continue;
        flag[results[i][self.displayProperty1]] = true;
        res.push(results[i]);
      }
      return res;
    }
964806
function (err, results) {
    err && console.error(err);

    results.forEach(function (result) {
        var failures = result.run.failures;

        console.info(failures.length ? JSON.stringify(failures.failures, null, 2) :
            `${result.collection.name} ran successfully.`);
    });
}
156698
function handleResults(results) {
    ctrl.matches = results;
    ctrl.hidden  = shouldHide();

    // If loading is in progress, then we'll end the progress. This is needed for example,
    // when the `clear` button was clicked, because there we always show the loading process, to prevent flashing.
    if (ctrl.loading) setLoading(false);

    if ($scope.selectOnMatch) selectItemOnMatch();

    positionDropdown();
    reportMessages(true, ReportType.Count);
  }
576996
function (err, result) {

		// if login is successful, we record the user's account in cache
		if (err) {
			LOG.warn(err.toString());
			result = {code: err.code, msg: err.message};
		}
		else {
			if (result.code === 0) {
				LOG.warn('login success, result: ');
				LOG.warn(result);

				var data = {
					account: user_data.account,
					groups: result.data.groups,
					lastStatus: result.data.lastStatus,
					permissions: []
				}
				
				l_initSession(event.data.login_id, event.session, data);

				/*
				// todo: read permssion from DB
				//event.session['_permissions'] = result.data.permissions;
				var xx = [];
				var onSuccess = function(dat){
					//console.log(dat.permission);
					if (dat === null) {
						console.log("no permission");
					}
					else {
						for (var i in dat.permission) {
							//console.log("pushing: " + dat.permission[i]);
							xx.push(dat.permission[i]);
						}
					}
					//event.done("get group", {"status": "success", "data": data});
				};
				var onFail = function(dat){
					//event.done("get group", {"status": "failure", "data": data});
				};
				for (var i in event.session['_groups']) {
					//console.log("getting: " + event.session['_groups'][i]);
					SR.DB.getData(groupPermissionDB, {"group": event.session['_groups'][i], part: "group"}, onSuccess, onFail);
				}
				*/
				
				// TODO: login at once to all local accounts
				// NOTE: need to query all local login account name & password, then perform individual logins
				l_login_local_accounts(user_data.account);			
			}
		}

		//LOG.warn('event before sending login response:');
		//LOG.warn(event);
		
		//if (result.data) delete result.data;
		// return response regardless success or fail
		event.done('SR_LOGIN_RESPONSE', result);
	}
614647
function resultRaw (results) {
    // throw error if results required and not retrieved
    if (this.args.required && !results.length) {
        // throw error
        throw this.error('no records found')
    }
    // if only ids were selected the return result object to fetch records
    if (this.select.isSelectOnlyIds) {
        // build result object
        var result = new ImmutableCoreModelResult({
            query: this,
            results: results,
        })
        // return result or all records if specified
        return this.args.all ? result.all() : result
    }
    // otherwise return ImmutableCoreModelInstance record(s)
    else {
        // query is for a single record
        if (this.args.limit === 1) {
            // return new instance or undefined
            return results.length
                ? this.newInstance(results[0])
                : undefined
        }
        // query is for multiple records
        else {
            return _.map(results, result => this.newInstance(result))
        }
    }
}
921330
function done( error, results ) {
		if ( error ) {
			return clbk( error );
		}
		if ( results ) {
			return clbk( null, results );
		}
		clbk();
	}
788111
function hasErrors(results) {
  return  (results.dependencies && results.dependencies.length) ||
          (results.devDependencies && results.devDependencies.length)
}
610594
function parseResult(text, callback) {
  var errors = [], i = 0, l, errBlock, match, match2, lines;

  text = text.replace(/\r/g, '');
  lines = text.split('\n');

  match = skippingRegex.exec(lines[i]);
  if (match) {
    i++;
  }

  match = successRegex.exec(lines[i]);
  if (match) {
    callback(null, createParseSuccessObj(match));
    return;
  }

  for (l = lines.length; i < l; i++) {
    match = fileRegex.exec(lines[i]);
    if (match) {
      match2 = errorRegex.exec(lines[++i]);
      errBlock = createFailObj(match);
      for (var j = i; match2 && j < lines.length;) {
        errBlock.errors.push(createErrorObj(match2));
        match2 = errorRegex.exec(lines[++j]);
      }
      i = --j;
      errors.push(errBlock);
    } else {
      match = abstractRegex.exec(lines[i]);
      if (match) {
        callback(createErrorGJSLintFailed(match, errors));
        return;
      }
    }
  }
  callback(createParseErrorUnknown(lines));

}
220746
function(err,results) {
                            var _stdout = fs.createReadStream(results[1]);
                            var _stderr = fs.createReadStream(results[0]);
                            jobObj.emit("completed", _stdout, _stderr, jobObj);
                        }
568851
function check(result, test) {

  const CHECKERS = [ _checkExitCode, _checkOutput, _checkStdout, _checkStderr ];
  var errors = [];

  CHECKERS.forEach(function (checker) {
    var error = checker(result, test);
    if (error) {
      errors.push(error);
    }
  });
  
  return errors;
}
551189
function firstResult(items, fn) {
	for (const item of items) {
		if (!item) {
			continue;
		}

		const result = fn(item);
		if (result) {
			return result;
		}
	}
	return undefined;
}
1277803
function(results, run, options, done) {

    run.errmessages = concatErrMessages(run.errmessages, results.errmessages);
    _.forOwn(results.modules, function(pkg, pkgName) {

      var npkg = {
        name: pkgName,
        suites: [],
        tests: pkg.tests,
        failures: pkg.failures,
        errors: pkg.errors,
        isFailure: (pkg.failures !== 0 && pkg.errors !== 0)
      };

      _.forOwn(pkg.completed, function(suite, suiteName) {

        var nsuite = {
          name: suiteName,
          pkgName: npkg.name,
          passed: suite.passed,
          failures: suite.failed,
          errors: suite.errors,
          skipped: suite.skipped,
          time: suite.time,
          cases: []
        };

        // Little weird here but the report object
        // will not report an error, it will instead
        // have X failed and empty assertions array.
        if (nsuite.failures > 0 && suite.assertions.length === 0)
          nsuite.errors = nsuite.failures;

        nsuite.isFailure = nsuite.failures !== 0 || nsuite.errors !== 0;
        npkg.suites.push(nsuite);

        _.each(suite.assertions, function(assertion) {

          var assert = _.clone(assertion, true);
          assert.screenshots = assert.screenshots || [];
          assert.isFailure = assertion.failure;
          nsuite.cases.push(assert);

          if (options.relativeScreenshots) {
            assert.screenshots = assert.screenshots.map(function(sspath) {
              return getRelativePath(options.fullOutputFilename, sspath);
            });
          }

          if (assert.isFailure)
            nsuite.isFailure = true;

        });

        if (nsuite.isFailure)
          npkg.isFailure = true;

      });

      run.addPackage(npkg);

      if (npkg.isFailure)
        run.isFailure = npkg.isFailure;

    });

    done(null, run);

  }
649327
function MatchResult(
    matcher,
    input,
    startExpr,
    cst,
    cstOffset,
    rightmostFailurePosition,
    optRecordedFailures) {

  this.matcher = matcher;
  this.input = input;
  this.startExpr = startExpr;
  this._cst = cst;
  this._cstOffset = cstOffset;
  this._rightmostFailurePosition = rightmostFailurePosition;
  this._rightmostFailures = optRecordedFailures;

  if (this.failed()) {
    common.defineLazyProperty(this, 'message', function() {
      var detail = 'Expected ' + this.getExpectedText();
      return util.getLineAndColumnMessage(this.input, this.getRightmostFailurePosition()) + detail;
    });
    common.defineLazyProperty(this, 'shortMessage', function() {
      var detail = 'expected ' + this.getExpectedText();
      var errorInfo = util.getLineAndColumn(this.input, this.getRightmostFailurePosition());
      return 'Line ' + errorInfo.lineNum + ', col ' + errorInfo.colNum + ': ' + detail;
    });
  }
}
503881
function computeReleases(result) {
  if (!result.stdout) return null

  // Trim last breakline.
  const dirs = result.stdout.replace(/\n$/, '')

  // Convert releases to an array.
  return dirs.split('\n')
}
246186
function handle(err, results) {
      if (err) {
        errors = errors || [];
        errors.push(err);
      }
      if (results) responses = responses.concat(results);

      // multi calls should ALWAYS return an array!
      if (!--calls) {
          callback(errors && errors.length ? errors.pop() : undefined, responses);
      }
    }