jsoverson/Backbone.Augment — pull request #2 by derickbailey (2012-10-22 15:12:38+00:00)
Title: Provide a mixInto function to mix a source's functions in to a target

As noted in my blog post on Mixins (http://lostechies.com/derickbailey/2012/10/07/javascript-mixins-beyond-simple-object-extension/) I would like to be able to mix a specific function from a source object in to a target object.

I added a `mixInto` function on to `Backbone.Augment` so that this can be done. As an example:

```js
aug = {
augment: function(t){
Backbone.Augment.mixInto(t, this, "foo");
},

foo: function(){
console.log("I'm the foo function!")
}
};

Target = Backbone.Model.extend({});
Target.prototype.augment(aug);

target = new Target();
target.foo(); // => "I'm the foo function!"
```

In order to make this work the way I would like to see it work, I needed to be able to `augment` a Backbone object's prototype, not just the type itself. As shown in this example, you can now augment a prototype directly:

`Backbone.Model.prototype.augment(...)`

This gives us more flexibility in augmenting either a base Backbone type or it's prototype, explicitly.