code: function validate(object, schema, options) {
          options = mixin({}, validate.defaults, options);
  
          if (options.trim === true) {
              // ensure that trim works in old browsers
              if (!String.prototype.trim) {
                  String.prototype.trim = function () {
                      return this.replace(/^\s+|\s+$/g, '');
                  };
              }
          }
  
          var errors = [];
  
          // handle array root element
          if (schema.items) {
              validateProperty(object, object, '', schema, options, errors);
          } else {
              validateObject(object, schema, options, errors);
          }
  
          return {
              valid: !(errors.length),
              errors: errors
          };
      }
docs: ### function validate (object, schema, options) #### {Object} object the object to validate. #### {Object} schema (optional) the JSON Schema to validate against. #### {Object} options (optional) options controlling the validation process. See {@link #validate.defaults) for details. Validate <code>object</code> against a JSON Schema. If <code>object</code> is self-describing (i.e. has a <code>$schema</code> property), it will also be validated against the referenced schema. [TODO]: This behaviour bay be suppressed by setting the {@link #validate.options.???} option to <code>???</code>.[/TODO]  If <code>schema</code> is not specified, and <code>object</code> is not self-describing, validation always passes.  <strong>Note:</strong> in order to pass options but no schema, <code>schema</code> <em>must</em> be specified in the call to <code>validate()</code>; otherwise, <code>options</code> will be interpreted as the schema. <code>schema</code> may be passed as <code>null</code>, <code>undefinded</code>, or the empty object (<code>{}</code>) in this case.