Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A javascript augment/extend library
JavaScript
branch: master
Failed to load latest commit information.
dist Release 0.1.0
lib
test added another test
.gitignore
CHANGELOG.md
README.md 0.0.3 - deep extend
component.json Release 0.1.0
grunt.js grunt
package.json Release 0.1.0

README.md

aug.js

Aug.js is simple augment/extend library. If you've used jQuery's $.extend, then you will be familiar with it.

Installation

download aug.js from dist directory.

or if you are using node

npm install aug

Usage

//Great for overriding defaults
var a = { a: 1 };
var b = { a: 2, b: 3 };
aug(a, b); //a = { a: 2, b: 3};

//Combining two objects
var a = { a: 1 };
var b = { b: 3 };
var c = aug({}, a, b); 
//c = { a: 1, b: 3};

//Extending a function
var f = function() {};
aug(f, {
    prop: 42
});
//f.prop == 42

//Extending a prototype
var Class1 = function() { };
Class1.prototype.test = function() {
    return 0;
};

aug(Class1.prototype, {
    test2: function() {
        return 5;
    }
});
var c = new Class();
c.test(); //returns 0;
c.test2(); //returns 5
Something went wrong with that request. Please try again.