How to extend an Object with a new method, "plugin-style"?
<p>Trying to "extend" myStuff object with a new method in a plugin-style fashion, but when I call the new plugin's method ($.validate.newthing()), I get a function does not exist error for it. </p>

<p>How can I properly extend myStuff with the "validation" plugin below?</p>

<pre><code>&lt;script type="text/javascript"&gt;
    var myStuff = function(){
        return {
          thingy: function() {
          // Stuff
          }
        }
    }();


    (function($){
      $.validate = function() {
        return {
          newthing: function(a) {
            return a + a;
          }
        }
      }
    })(myStuff);


    (function($) {

      console.log($.validate.newthing(2));

    })(myStuff);
&lt;/script&gt;
</code></pre>
