lib/validation.helper.js
function inheritsFrom(validatedClass, expectedParentClass, errorText) {
  if (
    //fail-fast if it is nil
    !validatedClass ||
    //lenient check whether class directly or indirectly inherits from expected class
    (!(validatedClass.prototype instanceof expectedParentClass) &&
      validatedClass !== expectedParentClass)
  ) {
    throw new ValidationError(
      errorText || `Validated class does not inherit from ${expectedParentClass.name}`
    );
  }
  return validatedClass;
}
function inheritsFrom(validatedClass, expectedParentClass, errorText) {
  if (
    //fail-fast if it is nil
    !validatedClass ||
    //lenient check whether class directly or indirectly inherits from expected class
    (!(validatedClass.prototype instanceof expectedParentClass) &&
      validatedClass !== expectedParentClass)
  ) {
    throw new ValidationError(
      errorText || `Validated class does not inherit from ${expectedParentClass.name}`
    );
  }
  return validatedClass;
}
function inheritsFrom ( validatedClass , expectedParentClass , errorText ) { if ( //fail-fast if it is nil ! validatedClass || //lenient check whether class directly or indirectly inherits from expected class ( ! ( validatedClass . prototype instanceof expectedParentClass ) && validatedClass !== expectedParentClass ) ) { throw new ValidationError ( errorText || ` ${ expectedParentClass . name } ` ) ; } return validatedClass ; }
Checks value to inherit from a given class or to be that class
@param validatedClass
@param {class} expectedParentClass
@param {string} [errorText] - message for error thrown if validation fails
@returns {Object} validatedObject
Checks value to inherit from a given class or to be that class