lib/validate-reql.js
function validateReQL (reql, reqlOpts, whitelist) {
  var args = assertArgs(arguments, {
    'reql': '*',
    '[reqlOpts]': 'object',
    'whitelist': 'array'
  })
  reql = args.reql
  reqlOpts = args.reqlOpts
  whitelist = args.whitelist
  var firstErr
  var errCount = 0
  var promises = whitelist.map(function (reqlValidator) {
    return validate(reql, reqlOpts, reqlValidator)
      .catch(function (err) {
        firstErr = firstErr || err
        errCount++
      })
  })
  return Promise.all(promises).then(function () {
    if (errCount === whitelist.length) {
      throw firstErr
    } else {
      return true
    }
  })
}
function validateReQL (reql, reqlOpts, whitelist) {
  var args = assertArgs(arguments, {
    'reql': '*',
    '[reqlOpts]': 'object',
    'whitelist': 'array'
  })
  reql = args.reql
  reqlOpts = args.reqlOpts
  whitelist = args.whitelist
  var firstErr
  var errCount = 0
  var promises = whitelist.map(function (reqlValidator) {
    return validate(reql, reqlOpts, reqlValidator)
      .catch(function (err) {
        firstErr = firstErr || err
        errCount++
      })
  })
  return Promise.all(promises).then(function () {
    if (errCount === whitelist.length) {
      throw firstErr
    } else {
      return true
    }
  })
}
function validateReQL ( reql , reqlOpts , whitelist ) { var args = assertArgs ( arguments , { 'reql' : '*' , '[reqlOpts]' : 'object' , 'whitelist' : 'array' } ) reql = args . reql reqlOpts = args . reqlOpts whitelist = args . whitelist var firstErr var errCount = 0 var promises = whitelist . map ( function ( reqlValidator ) { return validate ( reql , reqlOpts , reqlValidator ) . catch ( function ( err ) { firstErr = firstErr || err errCount ++ } ) } ) return Promise . all ( promises ) . then ( function ( ) { if ( errCount === whitelist . length ) { throw firstErr } else { return true } } ) }
validate reql and reql opts
@param  {Object} reql       rethinkdb query reql
@param  {Object} [reqlOpts] rethinkdb reql opts
@param  {Array} whitelist   reql validators/queries
@return {Promise.<Boolean>} isValid promise
validate reql and reql opts