title: Method overloading in jQuery plugin
body: <p>I came across this problem while I was trying to customize one of the 3rd party plugins we use in our web application.
  We tend to not update the core plugin file just to make sure we don't run into issues when we upgrade 3rd party plugins. Best way to avoid this is either extend existing functionality with new set of methods or to override existing plugin methods outside the main plugin file.</p>
  
  <p>One of the plugin I tried to apply this approach was written in an unusual way where it defined all methods in an object outside main plugin function.</p>
  
  <p>So my question is how do we Extend or more likely Overload one of the methods (validateFields, showErrorMsg) of valEngine plugin without updating plugin code.</p>
  
  <p>Here is a JS Fiddle with a rough prototype.
  <a href="http://jsfiddle.net/g9Ng9/" rel="nofollow">http://jsfiddle.net/g9Ng9/</a></p>
  
  <pre><code>// Can't update any of this.
  (function($) {
  
    "use strict";
  
    var methods = {
      validateFields: function() {
          console.log('I perform validation of fields!');
      },
      showErrorMsg: function() {
          console.log('I log error messages');
      }
    };
  
    $.fn.valEngine = function() {
      console.log('I access methods within method object!');
      methods.validateFields();
      methods.showErrorMsg();
    };
  })(jQuery);
  // Can't update any of this.
  
  
  // Your code goes here
  </code></pre>
  
  <p>Thanks in advance.</p>