src/adapter.js
function validateConstraints(matchingConstraints) {
  if (matchingConstraints.callbackId &&
      !(isString(matchingConstraints.callbackId) || isRegExp(matchingConstraints.callbackId))) {
    return new TypeError('Callback ID must be a string or RegExp');
  }

  if (matchingConstraints.blockId &&
    !(isString(matchingConstraints.blockId) || isRegExp(matchingConstraints.blockId))) {
    return new TypeError('Block ID must be a string or RegExp');
  }

  if (matchingConstraints.actionId &&
    !(isString(matchingConstraints.actionId) || isRegExp(matchingConstraints.actionId))) {
    return new TypeError('Action ID must be a string or RegExp');
  }

  return false;
}
function validateConstraints(matchingConstraints) {
  if (matchingConstraints.callbackId &&
      !(isString(matchingConstraints.callbackId) || isRegExp(matchingConstraints.callbackId))) {
    return new TypeError('Callback ID must be a string or RegExp');
  }

  if (matchingConstraints.blockId &&
    !(isString(matchingConstraints.blockId) || isRegExp(matchingConstraints.blockId))) {
    return new TypeError('Block ID must be a string or RegExp');
  }

  if (matchingConstraints.actionId &&
    !(isString(matchingConstraints.actionId) || isRegExp(matchingConstraints.actionId))) {
    return new TypeError('Action ID must be a string or RegExp');
  }

  return false;
}
function validateConstraints ( matchingConstraints ) { if ( matchingConstraints . callbackId && ! ( isString ( matchingConstraints . callbackId ) || isRegExp ( matchingConstraints . callbackId ) ) ) { return new TypeError ( 'Callback ID must be a string or RegExp' ) ; } if ( matchingConstraints . blockId && ! ( isString ( matchingConstraints . blockId ) || isRegExp ( matchingConstraints . blockId ) ) ) { return new TypeError ( 'Block ID must be a string or RegExp' ) ; } if ( matchingConstraints . actionId && ! ( isString ( matchingConstraints . actionId ) || isRegExp ( matchingConstraints . actionId ) ) ) { return new TypeError ( 'Action ID must be a string or RegExp' ) ; } return false ; }
Validates general properties of a matching constraints object
@param {Object} matchingConstraints - object describing the constraints on a callback
@returns {Error|false} - a false value represents successful validation, otherwise an error to
describe why validation failed.
@private
Validates general properties of a matching constraints object