code: function getValidationFunction (validationOptions) {
          validationOptions = validationOptions || {};
  
          return function (doc, schema, options) {
              doc = doc || {};
              options = options || {};
              options.isUpdate = options.isUpdate || false;
  
              // check is update
              if (options.isUpdate) {
                  var i,
                      keys = Object.keys(schema.properties),
                      length = keys.length;
  
                  for (i = 0; i < length; i++) {
                      if (!doc.hasOwnProperty(keys[i])) {
                          // set property required to false
                          schema.properties[keys[i]].required = false;
  
                          // remove property from required array
                          if (Array.isArray(schema.required) && schema.required.indexOf(keys[i]) > -1) {
                              schema.required.splice(schema.required.indexOf(keys[i]), 1);
                          }
                      }
                  }
              }
  
              // add default validation options to options object
              for (var key in validationOptions) {
                  // only add options, do not override
                  if (validationOptions.hasOwnProperty(key) && !options.hasOwnProperty(key)) {
                      options[key] = validationOptions[key];
                  }
              }
  
              // json schema validate
              return exports.validate(doc, schema, options);
          };
      }
docs: Gets the validate function and encapsulates some param checks
  
  @param {object=} validationOptions The validation options for revalidator.
  @return {function(doc, schema, options)}