lib/validation.helper.js
function withProperties(validatedObject, validatedProperties) {
  notNil(validatedObject);

  const undefinedProperties = _.filter(validatedProperties, function(property) {
    return !validatedObject.hasOwnProperty(property);
  });

  if (!_.isEmpty(undefinedProperties)) {
    throw new ValidationError("Validated object doesn't have properties: " + undefinedProperties);
  }
  return validatedObject;
}
function withProperties(validatedObject, validatedProperties) {
  notNil(validatedObject);

  const undefinedProperties = _.filter(validatedProperties, function(property) {
    return !validatedObject.hasOwnProperty(property);
  });

  if (!_.isEmpty(undefinedProperties)) {
    throw new ValidationError("Validated object doesn't have properties: " + undefinedProperties);
  }
  return validatedObject;
}
function withProperties ( validatedObject , validatedProperties ) { notNil ( validatedObject ) ; const undefinedProperties = _ . filter ( validatedProperties , function ( property ) { return ! validatedObject . hasOwnProperty ( property ) ; } ) ; if ( ! _ . isEmpty ( undefinedProperties ) ) { throw new ValidationError ( "Validated object doesn't have properties: " + undefinedProperties ) ; } return validatedObject ; }
Checks object to have at least a given set of properties defined
@param {*} validatedObject
@param {String[]} validatedProperties - names of properties which existence should be checked
@returns {*} validatedObject
Checks object to have at least a given set of properties defined