index.js
function validate(args, required) {
    var result = {
      error: false,
      message: 'No errors'
    }

    // ensure required properties were passed in the arguments hash
    if (required) {
      var keys = _.keys(args);
      required.forEach(function(field) {
        if(!_.contains(keys, field)) {
          result.error = true;
          result.message = 'The following values must be passed: ' + required.join(', ');
        }
      })
    }

    return result;

  }
function validate(args, required) {
    var result = {
      error: false,
      message: 'No errors'
    }

    // ensure required properties were passed in the arguments hash
    if (required) {
      var keys = _.keys(args);
      required.forEach(function(field) {
        if(!_.contains(keys, field)) {
          result.error = true;
          result.message = 'The following values must be passed: ' + required.join(', ');
        }
      })
    }

    return result;

  }
function validate ( args , required ) { var result = { error : false , message : 'No errors' } // ensure required properties were passed in the arguments hash if ( required ) { var keys = _ . keys ( args ) ; required . forEach ( function ( field ) { if ( ! _ . contains ( keys , field ) ) { result . error = true ; result . message = 'The following values must be passed: ' + required . join ( ', ' ) ; } } ) } return result ; }
utility method to validate inputs
utility method to validate inputs