Updated utils with new helper functions and tests.# Please enter the commit message for your changes. Lines starting# with '#' will be ignored, and an empty message aborts the commit.# On branch master# Your branch is ahead of 'origin/master' by 1 commit.#   (use "git push" to publish your local commits)## Changes to be committed:#   (use "git reset HEAD <file>..." to unstage)##	modified:   spec/utils.spec.js#	modified:   src/utils.js## Changes not staged for commit:#   (use "git add <file>..." to update what will be committed)#   (use "git checkout -- <file>..." to discard changes in working directory)##	modified:   src/Base.js#	modified:   src/View.js#diff --git spec/utils.spec.js spec/utils.spec.jsindex 683f546..a29e593 100644--- spec/utils.spec.js+++ spec/utils.spec.js@@ -1,90 +1 @@-require( ['utils'], function ( Utils ) {--	describe("utils", function () {--		describe("Utils.isObject", function () {--			describe("When isObject is called with an real Object", function () {-				it("Should return true", function () {-					expect(Utils.isObject({})).toEqual(true);-				});-			});-			describe("When isObject is called with an Array", function () {-				it("Should return false", function () {-					expect(Utils.isObject([])).toEqual(false);-				});-			});-			describe("When isObject is called with a Function", function () {-				it("Should return false", function () {-					expect(Utils.isObject(function () {})).toEqual(false);-				});-			});-			describe("When isObject is called with a Date", function () {-				it("Should return false", function () {-					expect(Utils.isObject(Date.now())).toEqual(false);-				});-			});-			describe("When isObject is called with a RegExp", function () {-				it("Should return false", function () {-					expect(Utils.isObject(/\d+/)).toEqual(false);-				});-			});-			describe("When isObject is called with a String", function () {-				it("Should return false", function () {-					expect(Utils.isObject("string")).toEqual(false);-				});-			});-			describe("When isObject is called with a Number", function () {-				it("Should return false", function () {-					expect(Utils.isObject(1)).toEqual(false);-				});-			});-			describe("When isObject is called with arguments", function () {-				it("Should return false", function () {-					expect(Utils.isObject(arguments)).toEqual(false);-				});-			});--		});--		describe("Utils.realTypeOf", function () {--			describe("When realTypeOf is called with an Object", function () {-				it("Should return 'object'", function () {-					expect(Utils.realTypeOf({})).toEqual("object");-				});-			});-			describe("When realTypeOf is called with an Array", function () {-				it("Should return 'array'", function () {-					expect(Utils.realTypeOf([])).toEqual("array");-				});-			});-			describe("When realTypeOf is called with a Function", function () {-				it("Should return 'function'", function () {-					expect(Utils.realTypeOf(function () {})).toEqual("function");-				});-			});-			describe("When realTypeOf is called with a String", function () {-				it("Should return 'string'", function () {-					expect(Utils.realTypeOf("string")).toEqual("string");-				});-			});-			describe("When realTypeOf is called with a Number", function () {-				it("Should return 'number'", function () {-					expect(Utils.realTypeOf(1)).toEqual("number");-				});-			});-			describe("When realTypeOf is called with a RegExp", function () {-				it("Should return 'regexp'", function () {-					expect(Utils.realTypeOf(/\d+/)).toEqual("regexp");-				});-			});-			describe("When realTypeOf is called with arguments", function () {-				it("Should return 'arguments'", function () {-					expect(Utils.realTypeOf(arguments)).toEqual("arguments");-				});-			});-		});-	});--});+require( ['utils'], function ( Utils ) {    describe("utils", function () {        describe("Utils.realTypeOf", function () {            describe("When realTypeOf is called with an Object", function () {                it("Should return 'object'", function () {                    expect(Utils.realTypeOf({})).toEqual("object");                });            });            describe("When realTypeOf is called with an Array", function () {                it("Should return 'array'", function () {                    expect(Utils.realTypeOf([])).toEqual("array");                });            });            describe("When realTypeOf is called with a Function", function () {                it("Should return 'function'", function () {                    expect(Utils.realTypeOf(function () {})).toEqual("function");                });            });            describe("When realTypeOf is called with a String", function () {                it("Should return 'string'", function () {                    expect(Utils.realTypeOf("string")).toEqual("string");                });            });            describe("When realTypeOf is called with a Number", function () {                it("Should return 'number'", function () {                    expect(Utils.realTypeOf(1)).toEqual("number");                });            });            describe("When realTypeOf is called with a RegExp", function () {                it("Should return 'regexp'", function () {                    expect(Utils.realTypeOf(/\d+/)).toEqual("regexp");                });            });            describe("When realTypeOf is called with arguments", function () {                it("Should return 'arguments'", function () {                    expect(Utils.realTypeOf(arguments)).toEqual("arguments");                });            });        });        describe("Utils.isObject", function () {            describe("When isObject is called with an real Object", function () {                it("Should return true", function () {                    expect(Utils.isObject({})).toEqual(true);                });            });            describe("When isObject is called with an Array", function () {                it("Should return false", function () {                    expect(Utils.isObject([])).toEqual(false);                });            });            describe("When isObject is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isObject(function () {})).toEqual(false);                });            });            describe("When isObject is called with a Date", function () {                it("Should return false", function () {                    expect(Utils.isObject(Date.now())).toEqual(false);                });            });            describe("When isObject is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isObject(/\d+/)).toEqual(false);                });            });            describe("When isObject is called with a String", function () {                it("Should return false", function () {                    expect(Utils.isObject("string")).toEqual(false);                });            });            describe("When isObject is called with a Number", function () {                it("Should return false", function () {                    expect(Utils.isObject(1)).toEqual(false);                });            });            describe("When isObject is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });        describe("Utils.isArray", function () {            describe("When isArray is called with an plain Object", function () {                it("Should return false", function () {                    expect(Utils.isArray({})).toEqual(false);                });            });            describe("When isArray is called with an Array", function () {                it("Should return true", function () {                    expect(Utils.isArray([])).toEqual(true);                });            });            describe("When isArray is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isArray(function () {})).toEqual(false);                });            });            describe("When isArray is called with a Date", function () {                it("Should return false", function () {                    expect(Utils.isArray(Date.now())).toEqual(false);                });            });            describe("When isArray is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isArray(/\d+/)).toEqual(false);                });            });            describe("When isArray is called with a String", function () {                it("Should return false", function () {                    expect(Utils.isArray("string")).toEqual(false);                });            });            describe("When isArray is called with a Number", function () {                it("Should return false", function () {                    expect(Utils.isArray(1)).toEqual(false);                });            });            describe("When isArray is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });        describe("Utils.isString", function () {            describe("When isString is called with an plain Object", function () {                it("Should return false", function () {                    expect(Utils.isString({})).toEqual(false);                });            });            describe("When isString is called with an Array", function () {                it("Should return false", function () {                    expect(Utils.isString([])).toEqual(false);                });            });            describe("When isString is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isString(function () {})).toEqual(false);                });            });            describe("When isString is called with a Date", function () {                it("Should return false", function () {                    expect(Utils.isString(Date.now())).toEqual(false);                });            });            describe("When isString is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isString(/\d+/)).toEqual(false);                });            });            describe("When isString is called with a String", function () {                it("Should return true", function () {                    expect(Utils.isString("string")).toEqual(true);                });            });            describe("When isString is called with a Number", function () {                it("Should return false", function () {                    expect(Utils.isString(1)).toEqual(false);                });            });            describe("When isString is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });        describe("Utils.isNumber", function () {            describe("When isNumber is called with an plain Object", function () {                it("Should return true", function () {                    expect(Utils.isNumber({})).toEqual(false);                });            });            describe("When isNumber is called with an Array", function () {                it("Should return false", function () {                    expect(Utils.isNumber([])).toEqual(false);                });            });            describe("When isNumber is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isNumber(function () {})).toEqual(false);                });            });            describe("When isNumber is called with a Date", function () {                it("Should return true", function () {                    expect(Utils.isNumber(Date.now())).toEqual(true);                });            });            describe("When isNumber is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isNumber(/\d+/)).toEqual(false);                });            });            describe("When isNumber is called with a String", function () {                it("Should return false", function () {                    expect(Utils.isNumber("string")).toEqual(false);                });            });            describe("When isNumber is called with a Number", function () {                it("Should return true", function () {                    expect(Utils.isNumber(1)).toEqual(true);                });            });            describe("When isNumber is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });    });});\ No newline at end of filediff --git src/utils.js src/utils.jsindex 123f12a..c8f9edb 100644--- src/utils.js+++ src/utils.js@@ -2,18 +2,35 @@ define( function ( ) {   return {-    isObject: function ( o ) {-      // Concat Object with string to-      // invoke toString() and test class definition-      return "[object Object]" === ''+o;-    },-     realTypeOf: function ( value ) {       // Borrow Object.toString to introspect the       // class definition of the value i.e. ([object Object])       // and return the latter portion which denotes       // the real type of the input value.       return ({}).toString.call(value).match( /\w+/g )[1].toLowerCase();+    },++    isObject: function ( value ) {+      //delegate to realTypeOf+      return this.realTypeOf(value) === 'object';+    },++    isArray: function ( value ) {+      if (Array.isArray) {+        return Array.isArray(value);+      }+      //delegate to realTypeOf if isArray is not supported+      return this.realTypeOf(value) === 'array';+    },++    isString: function ( value ) {+      //delegate to realTypeOf+      return this.realTypeOf(value) === 'string';+    },++    isNumber: function ( value ) {+      //delegate to realTypeOf+      return this.realTypeOf(value) === 'number';     }   };
modified getPrototype func to return prototype is already exists,
reducing number of instantiations
Fixed indent, updated with utils type checking and removed private func for constant.
Fixed indentation to four spaces.# Please enter the commit message for your changes. Lines starting# with '#' will be ignored, and an empty message aborts the commit.# On branch master# Your branch is ahead of 'origin/master' by 4 commits.#   (use "git push" to publish your local commits)## Changes to be committed:#   (use "git reset HEAD <file>..." to unstage)##	modified:   spec/Collection.spec.js#	modified:   spec/Model.spec.js#	modified:   spec/utils.spec.js#	modified:   src/events.js#	modified:   src/mediator.js## Changes not staged for commit:#   (use "git add <file>..." to update what will be committed)#   (use "git checkout -- <file>..." to discard changes in working directory)##	modified:   spec/View.spec.js#	modified:   src/Base.js#	modified:   src/Model.js#	modified:   src/View.js#	modified:   src/utils.js#diff --git spec/Collection.spec.js spec/Collection.spec.jsindex 4c3da32..e8ce20b 100644--- spec/Collection.spec.js+++ spec/Collection.spec.js@@ -1,166 +1 @@-require( ['Base', 'Collection', 'Model'], function ( Base, Collection, Model ) {--	describe("Collection", function () {-		var collection = null;--		describe("When a collection is created without options", function () {-			it("Should not throw an error", function () {-				expect(function () {-					collection =  Collection.create();-				}).not.toThrow();-			});-		});-		describe("When a collection is created without a model", function () {-			beforeEach(function () {-				collection =  Collection.create();-			});-			afterEach(function () {-				collection = null;-			});-			describe("When a collection recieves 1 new object", function () {-				var spyFire,-					obj = {text: "I like Mangoes"};--				beforeEach(function () {-					spyFire = spyOn(collection, "fire");-					collection.add(obj);-				});-				it("Should fire an 'add' event with the data that was added", function () {-					expect(spyFire.mostRecentCall.args[0]).toEqual( 'add' );-					expect(spyFire.mostRecentCall.args[1].properties).toEqual( obj );-				});-			});-		});-		describe("When a collection is created with a model", function () {-			beforeEach(function () {-				collection = Collection.create({-					model: Model-				});-			});-			afterEach(function () {-				collection.getCurrentModel().resetId();-				collection = null;-			});-			describe("When a collection recieves 1 new object", function () {-				var spyFire,-					obj = {text: "I like Mangoes"};--				beforeEach(function () {-					collection.reset();-					spyFire = spyOn(collection, "fire");-					collection.add(obj);-				});-				it("Should fire an 'add' event with the new model", function () {-					expect(spyFire.mostRecentCall.args[0]).toEqual( 'add' );-					expect(spyFire.mostRecentCall.args[1].properties).toEqual( obj );-				});-			});-			describe("When a collection recieves two new objects", function () {-				var spyFire,-					obj1 = {text: "I like Mangoes"},-					obj2 = {text: "I like Bananas"};--				beforeEach(function () {-					collection.reset();-					spyFire = spyOn(collection, "fire");-					collection.add([obj1, obj2]);-				});-				it("Should fire the 'add' event twice", function () {-					expect(spyFire.callCount).toEqual(2);-				});-				it("Should fire an 'add' event with a new model for obj1", function () {-					expect(spyFire.mostRecentCall.args[0]).toEqual( 'add' );-					expect(spyFire.mostRecentCall.args[1].properties).toEqual( obj1 );-				});-				it("Should fire an 'add' event with a new model for obj2", function () {-					expect(spyFire.mostRecentCall.args[0]).toEqual( 'add' );-					expect(spyFire.mostRecentCall.object.models[0].properties).toEqual( obj2 );-				});-			});-			describe("When the collection has 2  models", function () {-				var obj1 = {text: "I like Mangoes"},-					obj2 = {text: "I like Bananas"},-					spyFire;--				beforeEach(function () {-					collection.reset();-					spyFire = spyOn(collection, "fire");-					collection.add([obj1, obj2]);-				});-				describe("When removedById is called with the id of the first model", function () {-					beforeEach(function () {-						collection.removeById("mid_1");-					});-					it("Should remove the model with the id 'mid_1' from the collection", function () {-						expect(typeof collection.getById("mid_1")).toBe("undefined");-					});-					it("Should NOT remove the model with the id 'mid_2' from the collection", function () {-						expect(typeof collection.getById("mid_2")).toBe("object");-					});-					it("Should still have 1 model", function () {-						expect(collection.getModels().length).toEqual(1);-					});-					it("Should fire 1 'removed' event with a list of the remaining models", function () {-						expect(spyFire.mostRecentCall.args).toEqual(["removed", [collection.getById("mid_2")]]);-					});-				});-			});-			describe("When the collection has 3 models", function () {-				describe("When 2 of the models have the same text", function () {-					var obj1 = {text: "I like Mangoes"},-						obj2 = {text: "I like Bananas"},-						obj3 = {text: "I like Bananas"},-						spyFire;--					beforeEach(function () {-						collection.reset();-						spyFire = spyOn(collection, "fire");-						collection.add([obj1, obj2, obj3]);-					});-					describe("When removeByText is called with 'I like Bananas'", function () {-						beforeEach(function () {-							collection.removeByText("I like Bananas");-						});-						it("Should remove the models with the text 'I like Bananas' from the collection", function () {-							expect(typeof collection.getByText("I like Bananas")).toEqual("undefined");-						});-						it("Should NOT remove the model with the text 'I like Mangoes' from the collection", function () {-							expect(typeof collection.getByText("I like Mangoes")).toEqual("object");-						});-						it("Should still have 1 model", function () {-							expect(collection.getModels().length).toEqual(1);-						});-						it("Should fire a 'removed' event with the remaining models", function () {-							expect(spyFire.mostRecentCall.args).toEqual(["removed", collection.getModels()]);-						});-					});-				});-			});-			describe("When the collection has 6 models", function () {-				var note1 = {text: "I like Mangoes"},-					note2 = {text: "I like Bananas"},-					note3 = {text: "I like Apples"},-					note4 = {text: "I like Mangoes"},-					note5 = {text: "I like Houmous"},-					note6 = {text: "I like Olives"},-					spyFire;--				beforeEach(function () {-					spyFire = spyOn(collection, "fire");-					collection.add([note1, note2, note3, note4, note5, note6]);-				});-				describe("When the collection is reset", function () {-					beforeEach(function () {-						collection.reset();-					});-					it("Should remove all the models", function () {-						expect(collection.getModels().length).toEqual(0);-					});-					it("Should fire a reset event", function () {-						expect(spyFire).toHaveBeenCalledWith("reset");-					});-				});-			});-		});-	});-});\ No newline at end of file+require( ['Collection', 'Model'], function ( Collection, Model ) {    describe("Collection", function () {        var collection = null;        describe("When a collection is created without options", function () {            it("Should not throw an error", function () {                expect(function () {                    collection =  Collection.create();                }).not.toThrow();            });        });        describe("When a collection is created without a model", function () {            beforeEach(function () {                collection =  Collection.create();            });            afterEach(function () {                collection = null;            });            describe("When a collection recieves 1 new object", function () {                var spyFire,                    obj = {text: "I like Mangoes"};                beforeEach(function () {                    spyFire = spyOn(collection, "fire");                    collection.add(obj);                });                it("Should fire an 'add' event with the data that was added", function () {                    expect(spyFire.mostRecentCall.args[0]).toEqual( 'add' );                    expect(spyFire.mostRecentCall.args[1].properties).toEqual( obj );                });            });        });        describe("When a collection is created with a model", function () {            beforeEach(function () {                collection = Collection.create({                    model: Model                });            });            afterEach(function () {                collection.getCurrentModel().resetId();                collection = null;            });            describe("When a collection recieves 1 new object", function () {                var spyFire,                    obj = {text: "I like Mangoes"};                beforeEach(function () {                    collection.reset();                    spyFire = spyOn(collection, "fire");                    collection.add(obj);                });                it("Should fire an 'add' event with the new model", function () {                    expect(spyFire.mostRecentCall.args[0]).toEqual( 'add' );                    expect(spyFire.mostRecentCall.args[1].properties).toEqual( obj );                });            });            describe("When a collection recieves two new objects", function () {                var spyFire,                    obj1 = {text: "I like Mangoes"},                    obj2 = {text: "I like Bananas"};                beforeEach(function () {                    collection.reset();                    spyFire = spyOn(collection, "fire");                    collection.add([obj1, obj2]);                });                it("Should fire the 'add' event twice", function () {                    expect(spyFire.callCount).toEqual(2);                });                it("Should fire an 'add' event with a new model for obj1", function () {                    expect(spyFire.mostRecentCall.args[0]).toEqual( 'add' );                    expect(spyFire.mostRecentCall.args[1].properties).toEqual( obj1 );                });                it("Should fire an 'add' event with a new model for obj2", function () {                    expect(spyFire.mostRecentCall.args[0]).toEqual( 'add' );                    expect(spyFire.mostRecentCall.object.models[0].properties).toEqual( obj2 );                });            });            describe("When the collection has 2  models", function () {                var obj1 = {text: "I like Mangoes"},                    obj2 = {text: "I like Bananas"},                    spyFire;                beforeEach(function () {                    collection.reset();                    spyFire = spyOn(collection, "fire");                    collection.add([obj1, obj2]);                });                describe("When removedById is called with the id of the first model", function () {                    beforeEach(function () {                        collection.removeById("mid_1");                    });                    it("Should remove the model with the id 'mid_1' from the collection", function () {                        expect(typeof collection.getById("mid_1")).toBe("undefined");                    });                    it("Should NOT remove the model with the id 'mid_2' from the collection", function () {                        expect(typeof collection.getById("mid_2")).toBe("object");                    });                    it("Should still have 1 model", function () {                        expect(collection.getModels().length).toEqual(1);                    });                    it("Should fire 1 'removed' event with a list of the remaining models", function () {                        expect(spyFire.mostRecentCall.args).toEqual(["removed", [collection.getById("mid_2")]]);                    });                });            });            describe("When the collection has 3 models", function () {                describe("When 2 of the models have the same text", function () {                    var obj1 = {text: "I like Mangoes"},                        obj2 = {text: "I like Bananas"},                        obj3 = {text: "I like Bananas"},                        spyFire;                    beforeEach(function () {                        collection.reset();                        spyFire = spyOn(collection, "fire");                        collection.add([obj1, obj2, obj3]);                    });                    describe("When removeByText is called with 'I like Bananas'", function () {                        beforeEach(function () {                            collection.removeByText("I like Bananas");                        });                        it("Should remove the models with the text 'I like Bananas' from the collection", function () {                            expect(typeof collection.getByText("I like Bananas")).toEqual("undefined");                        });                        it("Should NOT remove the model with the text 'I like Mangoes' from the collection", function () {                            expect(typeof collection.getByText("I like Mangoes")).toEqual("object");                        });                        it("Should still have 1 model", function () {                            expect(collection.getModels().length).toEqual(1);                        });                        it("Should fire a 'removed' event with the remaining models", function () {                            expect(spyFire.mostRecentCall.args).toEqual(["removed", collection.getModels()]);                        });                    });                });            });            describe("When the collection has 6 models", function () {                var note1 = {text: "I like Mangoes"},                    note2 = {text: "I like Bananas"},                    note3 = {text: "I like Apples"},                    note4 = {text: "I like Mangoes"},                    note5 = {text: "I like Houmous"},                    note6 = {text: "I like Olives"},                    spyFire;                beforeEach(function () {                    spyFire = spyOn(collection, "fire");                    collection.add([note1, note2, note3, note4, note5, note6]);                });                describe("When the collection is reset", function () {                    beforeEach(function () {                        collection.reset();                    });                    it("Should remove all the models", function () {                        expect(collection.getModels().length).toEqual(0);                    });                    it("Should fire a reset event", function () {                        expect(spyFire).toHaveBeenCalledWith("reset");                    });                });            });        });    });});\ No newline at end of filediff --git spec/Model.spec.js spec/Model.spec.jsindex 7959155..092b7f0 100644--- spec/Model.spec.js+++ spec/Model.spec.js@@ -1,69 +1 @@-require( ['Base', 'Model'], function ( Base, Model ) {--	describe("Model", function () {--		var model = null;--		describe("When 3 new models are created without attributes", function () {-			var attributes = {-				item: "note",-				time: +Date.now()-			},-			models = [],-			count = 3;-			beforeEach(function () {-				while (0 < count--) {-					model = Model.create(attributes);-					models.push(model);-				}-				count = models.length;-			});-			afterEach(function () {-				var count = models.length;-				while (0 < count--) {-					models[count].resetId();-				}-				models = [];-			});-			it("Should give each model an id incremented by 1 starting at 'mid_1'", function () {-				var countId;-				while (count--) {-					countId = count + 1;-					expect(models[count].id).toEqual("mid_" + countId);-				}-			});-		});--		describe("When 3 models are created with attributes", function () {-			var attributes = {-				item: "note",-				time: +Date.now()-			},-			model,-			models = [],-			count = 3;-			beforeEach(function () {-				while (0 < count--) {-					model = Model.create(attributes);-					models.push(model);-				}-				count = models.length;-			});-			afterEach(function () {-				models = [];-			});-			it("Should give each model an id incremented by 1 starting at 'mid_1'", function () {-				var countId;-				while (count--) {-					countId = count + 1;-					expect(models[count].id).toEqual("mid_" + countId);-				}-			});-			it("Should have a property equal to each of the attributes passed in", function () {-				for (var attr in attributes) {-					expect(model.get(attr)).toEqual(attributes[attr]);-				}-			});-		});-	});-});\ No newline at end of file+require( ['Model'], function ( Model ) {    describe("Model", function () {        var model = null;        describe("When 3 new models are created without attributes", function () {            var attributes = {                item: "note",                time: +Date.now()            },            models = [],            count = 3;            beforeEach(function () {                while (0 < count--) {                    model = Model.create(attributes);                    models.push(model);                }                count = models.length;            });            afterEach(function () {                var count = models.length;                while (0 < count--) {                    models[count].resetId();                }                models = [];            });            it("Should give each model an id incremented by 1 starting at 'mid_1'", function () {                var countId;                while (count--) {                    countId = count + 1;                    expect(models[count].id).toEqual("mid_" + countId);                }            });        });        describe("When 3 models are created with attributes", function () {            var attributes = {                item: "note",                time: +Date.now()            },            model,            models = [],            count = 3;            beforeEach(function () {                while (0 < count--) {                    model = Model.create(attributes);                    models.push(model);                }                count = models.length;            });            afterEach(function () {                models = [];            });            it("Should give each model an id incremented by 1 starting at 'mid_1'", function () {                var countId;                while (count--) {                    countId = count + 1;                    expect(models[count].id).toEqual("mid_" + countId);                }            });            it("Should have a property equal to each of the attributes passed in", function () {                for (var attr in attributes) {                    expect(model.get(attr)).toEqual(attributes[attr]);                }            });        });    });});\ No newline at end of filediff --git spec/utils.spec.js spec/utils.spec.jsindex a29e593..50b5692 100644--- spec/utils.spec.js+++ spec/utils.spec.js@@ -1 +1 @@-require( ['utils'], function ( Utils ) {    describe("utils", function () {        describe("Utils.realTypeOf", function () {            describe("When realTypeOf is called with an Object", function () {                it("Should return 'object'", function () {                    expect(Utils.realTypeOf({})).toEqual("object");                });            });            describe("When realTypeOf is called with an Array", function () {                it("Should return 'array'", function () {                    expect(Utils.realTypeOf([])).toEqual("array");                });            });            describe("When realTypeOf is called with a Function", function () {                it("Should return 'function'", function () {                    expect(Utils.realTypeOf(function () {})).toEqual("function");                });            });            describe("When realTypeOf is called with a String", function () {                it("Should return 'string'", function () {                    expect(Utils.realTypeOf("string")).toEqual("string");                });            });            describe("When realTypeOf is called with a Number", function () {                it("Should return 'number'", function () {                    expect(Utils.realTypeOf(1)).toEqual("number");                });            });            describe("When realTypeOf is called with a RegExp", function () {                it("Should return 'regexp'", function () {                    expect(Utils.realTypeOf(/\d+/)).toEqual("regexp");                });            });            describe("When realTypeOf is called with arguments", function () {                it("Should return 'arguments'", function () {                    expect(Utils.realTypeOf(arguments)).toEqual("arguments");                });            });        });        describe("Utils.isObject", function () {            describe("When isObject is called with an real Object", function () {                it("Should return true", function () {                    expect(Utils.isObject({})).toEqual(true);                });            });            describe("When isObject is called with an Array", function () {                it("Should return false", function () {                    expect(Utils.isObject([])).toEqual(false);                });            });            describe("When isObject is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isObject(function () {})).toEqual(false);                });            });            describe("When isObject is called with a Date", function () {                it("Should return false", function () {                    expect(Utils.isObject(Date.now())).toEqual(false);                });            });            describe("When isObject is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isObject(/\d+/)).toEqual(false);                });            });            describe("When isObject is called with a String", function () {                it("Should return false", function () {                    expect(Utils.isObject("string")).toEqual(false);                });            });            describe("When isObject is called with a Number", function () {                it("Should return false", function () {                    expect(Utils.isObject(1)).toEqual(false);                });            });            describe("When isObject is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });        describe("Utils.isArray", function () {            describe("When isArray is called with an plain Object", function () {                it("Should return false", function () {                    expect(Utils.isArray({})).toEqual(false);                });            });            describe("When isArray is called with an Array", function () {                it("Should return true", function () {                    expect(Utils.isArray([])).toEqual(true);                });            });            describe("When isArray is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isArray(function () {})).toEqual(false);                });            });            describe("When isArray is called with a Date", function () {                it("Should return false", function () {                    expect(Utils.isArray(Date.now())).toEqual(false);                });            });            describe("When isArray is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isArray(/\d+/)).toEqual(false);                });            });            describe("When isArray is called with a String", function () {                it("Should return false", function () {                    expect(Utils.isArray("string")).toEqual(false);                });            });            describe("When isArray is called with a Number", function () {                it("Should return false", function () {                    expect(Utils.isArray(1)).toEqual(false);                });            });            describe("When isArray is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });        describe("Utils.isString", function () {            describe("When isString is called with an plain Object", function () {                it("Should return false", function () {                    expect(Utils.isString({})).toEqual(false);                });            });            describe("When isString is called with an Array", function () {                it("Should return false", function () {                    expect(Utils.isString([])).toEqual(false);                });            });            describe("When isString is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isString(function () {})).toEqual(false);                });            });            describe("When isString is called with a Date", function () {                it("Should return false", function () {                    expect(Utils.isString(Date.now())).toEqual(false);                });            });            describe("When isString is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isString(/\d+/)).toEqual(false);                });            });            describe("When isString is called with a String", function () {                it("Should return true", function () {                    expect(Utils.isString("string")).toEqual(true);                });            });            describe("When isString is called with a Number", function () {                it("Should return false", function () {                    expect(Utils.isString(1)).toEqual(false);                });            });            describe("When isString is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });        describe("Utils.isNumber", function () {            describe("When isNumber is called with an plain Object", function () {                it("Should return true", function () {                    expect(Utils.isNumber({})).toEqual(false);                });            });            describe("When isNumber is called with an Array", function () {                it("Should return false", function () {                    expect(Utils.isNumber([])).toEqual(false);                });            });            describe("When isNumber is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isNumber(function () {})).toEqual(false);                });            });            describe("When isNumber is called with a Date", function () {                it("Should return true", function () {                    expect(Utils.isNumber(Date.now())).toEqual(true);                });            });            describe("When isNumber is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isNumber(/\d+/)).toEqual(false);                });            });            describe("When isNumber is called with a String", function () {                it("Should return false", function () {                    expect(Utils.isNumber("string")).toEqual(false);                });            });            describe("When isNumber is called with a Number", function () {                it("Should return true", function () {                    expect(Utils.isNumber(1)).toEqual(true);                });            });            describe("When isNumber is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });    });});\ No newline at end of file+require( ['utils'], function ( Utils ) {    describe("utils", function () {        describe("Utils.realTypeOf", function () {            describe("When realTypeOf is called with an Object", function () {                it("Should return 'object'", function () {                    expect(Utils.realTypeOf({})).toEqual("object");                });            });            describe("When realTypeOf is called with an Array", function () {                it("Should return 'array'", function () {                    expect(Utils.realTypeOf([])).toEqual("array");                });            });            describe("When realTypeOf is called with a Function", function () {                it("Should return 'function'", function () {                    expect(Utils.realTypeOf(function () {})).toEqual("function");                });            });            describe("When realTypeOf is called with a String", function () {                it("Should return 'string'", function () {                    expect(Utils.realTypeOf("string")).toEqual("string");                });            });            describe("When realTypeOf is called with a Number", function () {                it("Should return 'number'", function () {                    expect(Utils.realTypeOf(1)).toEqual("number");                });            });            describe("When realTypeOf is called with a RegExp", function () {                it("Should return 'regexp'", function () {                    expect(Utils.realTypeOf(/\d+/)).toEqual("regexp");                });            });            describe("When realTypeOf is called with arguments", function () {                it("Should return 'arguments'", function () {                    expect(Utils.realTypeOf(arguments)).toEqual("arguments");                });            });        });        describe("Utils.isObject", function () {            describe("When isObject is called with an real Object", function () {                it("Should return true", function () {                    expect(Utils.isObject({})).toEqual(true);                });            });            describe("When isObject is called with an Array", function () {                it("Should return false", function () {                    expect(Utils.isObject([])).toEqual(false);                });            });            describe("When isObject is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isObject(function () {})).toEqual(false);                });            });            describe("When isObject is called with a Date", function () {                it("Should return false", function () {                    expect(Utils.isObject(Date.now())).toEqual(false);                });            });            describe("When isObject is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isObject(/\d+/)).toEqual(false);                });            });            describe("When isObject is called with a String", function () {                it("Should return false", function () {                    expect(Utils.isObject("string")).toEqual(false);                });            });            describe("When isObject is called with a Number", function () {                it("Should return false", function () {                    expect(Utils.isObject(1)).toEqual(false);                });            });            describe("When isObject is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });        describe("Utils.isArray", function () {            describe("When isArray is called with an plain Object", function () {                it("Should return false", function () {                    expect(Utils.isArray({})).toEqual(false);                });            });            describe("When isArray is called with an Array", function () {                it("Should return true", function () {                    expect(Utils.isArray([])).toEqual(true);                });            });            describe("When isArray is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isArray(function () {})).toEqual(false);                });            });            describe("When isArray is called with a Date", function () {                it("Should return false", function () {                    expect(Utils.isArray(Date.now())).toEqual(false);                });            });            describe("When isArray is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isArray(/\d+/)).toEqual(false);                });            });            describe("When isArray is called with a String", function () {                it("Should return false", function () {                    expect(Utils.isArray("string")).toEqual(false);                });            });            describe("When isArray is called with a Number", function () {                it("Should return false", function () {                    expect(Utils.isArray(1)).toEqual(false);                });            });            describe("When isArray is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });        describe("Utils.isString", function () {            describe("When isString is called with an plain Object", function () {                it("Should return false", function () {                    expect(Utils.isString({})).toEqual(false);                });            });            describe("When isString is called with an Array", function () {                it("Should return false", function () {                    expect(Utils.isString([])).toEqual(false);                });            });            describe("When isString is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isString(function () {})).toEqual(false);                });            });            describe("When isString is called with a Date", function () {                it("Should return false", function () {                    expect(Utils.isString(Date.now())).toEqual(false);                });            });            describe("When isString is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isString(/\d+/)).toEqual(false);                });            });            describe("When isString is called with a String", function () {                it("Should return true", function () {                    expect(Utils.isString("string")).toEqual(true);                });            });            describe("When isString is called with a Number", function () {                it("Should return false", function () {                    expect(Utils.isString(1)).toEqual(false);                });            });            describe("When isString is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });        describe("Utils.isNumber", function () {            describe("When isNumber is called with an plain Object", function () {                it("Should return true", function () {                    expect(Utils.isNumber({})).toEqual(false);                });            });            describe("When isNumber is called with an Array", function () {                it("Should return false", function () {                    expect(Utils.isNumber([])).toEqual(false);                });            });            describe("When isNumber is called with a Function", function () {                it("Should return false", function () {                    expect(Utils.isNumber(function () {})).toEqual(false);                });            });            describe("When isNumber is called with a Date", function () {                it("Should return true", function () {                    expect(Utils.isNumber(Date.now())).toEqual(true);                });            });            describe("When isNumber is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isNumber(/\d+/)).toEqual(false);                });            });            describe("When isNumber is called with a String", function () {                it("Should return false", function () {                    expect(Utils.isNumber("string")).toEqual(false);                });            });            describe("When isNumber is called with a Number", function () {                it("Should return true", function () {                    expect(Utils.isNumber(1)).toEqual(true);                });            });            describe("When isNumber is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });        describe("Utils.isFunction", function () {            describe("When isFunction is called with an plain Object", function () {                it("Should return false", function () {                    expect(Utils.isFunction({})).toEqual(false);                });            });            describe("When isFunction is called with an Array", function () {                it("Should return false", function () {                    expect(Utils.isFunction([])).toEqual(false);                });            });            describe("When isFunction is called with a Function", function () {                it("Should return true", function () {                    expect(Utils.isFunction(function () {})).toEqual(true);                });            });            describe("When isFunction is called with a Date", function () {                it("Should return false", function () {                    expect(Utils.isFunction(Date.now())).toEqual(false);                });            });            describe("When isFunction is called with a RegExp", function () {                it("Should return false", function () {                    expect(Utils.isFunction(/\d+/)).toEqual(false);                });            });            describe("When isFunction is called with a String", function () {                it("Should return false", function () {                    expect(Utils.isFunction("string")).toEqual(false);                });            });            describe("When isFunction is called with a Number", function () {                it("Should return false", function () {                    expect(Utils.isFunction(1)).toEqual(false);                });            });            describe("When isFunction is called with arguments", function () {                it("Should return false", function () {                    expect(Utils.isObject(arguments)).toEqual(false);                });            });        });    });});\ No newline at end of filediff --git src/events.js src/events.jsindex 6b5b2fd..3c0966f 100644--- src/events.js+++ src/events.js@@ -1,116 +1 @@-define ( function ( ) {--	return {--		events: {},--		on: function (event, callback) {--      var context;--      if ( "string" != typeof event ) {-        throw new Error("on() needs an event name string");-      }--      if ( "function" != typeof callback ) {-        throw new Error("on() needs a callback function");-      }--      context = [].slice.call( arguments, 2 )[0];--      if ( !this.events[event] ) {-        this.events[event] = [];-      }--      this.events[event].push({-        callback: callback,-        context: context-      });--    },--    reset: function () {-      this.events = {};-    },--    off: function (event) {--      var ev, len, cb;--      // Event must be a string-      if ( "string" != typeof event ) {-        throw new Error( "off() needs an event" );-      }--      cb = [].slice.call( arguments, 1 )[0];--      // If the event has been registered-      if ( this.events[event] ) {--        ev = this.events[event];-        len = ev.length;--        // Loop over each event object that matches ours.-        while ( len-- ) {--          if ( "function" != typeof cb ) {-            // If no callback was given, remove the event-            // and all its callbacks-            ev.splice(len, 1);--          } else {-            // If a callback was passed,-            // remove the callback from the event-            if ( ev[len].callback === cb ) {--              ev[len].callback = null;--              delete ev[len].callback;-            }--          }--        }--      }--    },--    fire: function ( event ) {--      var ev, len, opt, data, ctx;--      // event argument is mandatory-      if ( "string" != typeof event ) {-        throw new Error("fire() needs an event");-      }--      // Optional arguments-      opt = [].slice.call( arguments, 1 );-      data = opt[0];-      ctx = opt[1];--      // If this event has been registered-      if ( this.events[event] ) {--        len = this.events[event].length;--        // Invoke the callback on each event object-        while ( ev = this.events[event][--len] ) {--          if ("function" == typeof ev.callback) {--            // Invoke in either context with data if present-            ev.callback.call( ( ctx || ev.context || this ), data );--          }--        }--      }--    }--	};--});+define ( function ( ) {  return {    events: {},    on: function (event, callback) {      var context;      if ( "string" != typeof event ) {        throw new Error("on() needs an event name string");      }      if ( "function" != typeof callback ) {        throw new Error("on() needs a callback function");      }      context = [].slice.call( arguments, 2 )[0];      if ( !this.events[event] ) {        this.events[event] = [];      }      this.events[event].push({        callback: callback,        context: context      });    },    reset: function () {      this.events = {};    },    off: function (event) {      var ev, len, cb;      // Event must be a string      if ( "string" != typeof event ) {        throw new Error( "off() needs an event" );      }      cb = [].slice.call( arguments, 1 )[0];      // If the event has been registered      if ( this.events[event] ) {        ev = this.events[event];        len = ev.length;        // Loop over each event object that matches ours.        while ( len-- ) {          if ( "function" != typeof cb ) {            // If no callback was given, remove the event            // and all its callbacks            ev.splice(len, 1);          } else {            // If a callback was passed,            // remove the callback from the event            if ( ev[len].callback === cb ) {              ev[len].callback = null;              delete ev[len].callback;            }          }        }      }    },    fire: function ( event ) {      var ev, len, opt, data, ctx;      // event argument is mandatory      if ( "string" != typeof event ) {        throw new Error("fire() needs an event");      }      // Optional arguments      opt = [].slice.call( arguments, 1 );      data = opt[0];      ctx = opt[1];      // If this event has been registered      if ( this.events[event] ) {        len = this.events[event].length;        // Invoke the callback on each event object        while ( ev = this.events[event][--len] ) {          if ("function" == typeof ev.callback) {            // Invoke in either context with data if present            ev.callback.call( ( ctx || ev.context || this ), data );          }        }      }    }  };});\ No newline at end of filediff --git src/mediator.js src/mediator.jsindex 6db426a..2684d3c 100644--- src/mediator.js+++ src/mediator.js@@ -1,363 +1 @@-define( function ( ) {--	/**-		* A little helper to remove duplication-		* @param type {String} to|from-		* @param obj {Object}-		* @param eventName {String}-		* @private-		*/-	function add (type, obj, eventName) {--		passes[ currentEvent ][ type ].push({-			obj: obj,-			eventName: eventName-		});--	}--	function isEqual (a, b) {--		if (a === b) {-			return a !== 0 || 1 / a === 1 / b;-		}--		if (a === null || b === null) {-			return a === b;-		}--		if (Object.prototype.toString.call(a) !== Object.prototype.toString.call(b)) {-			return false;-		}--	}--	// Polyfill for nativeForEach-	function each (list, callback, context) {--		var i;--		// Native forEach-		if (typeof Array.prototype.forEach == "function" && list.length) {--			list.forEach( callback, context || this);--		} else if ( list.length ) {--			// Polyfill-			Array.prototype.forEach = function( callback, context ) {--				for (var i = 0, len = list.length; i < len; ++i) {--					callback.call(context, list[i], i, list);--				}--			};--		} else {--			// If the list is an [object Object] (i.e. Not an Array)-			for ( i in list ) {--				if ( list.hasOwnProperty( i ) ) {--					callback.call( context || this, list[i], i, list );--				}--			}--		}--	}--	/**-	* Bind one or more target events to one or more source events-	* @private-	*/-	function bind () {--		each( passes[ currentEvent ], function (sources, type, passes) {--			each( passes, function ( sources, type, pass ) {--				each( pass.from, function ( from ) {--					// Remove any previous binding-					from.obj.off( from.eventName );--					// Bind the event to a callback-					from.obj.on( from.eventName, function( args ) {--						each( pass.to, function ( to ) {--							// The callback binds the |to| event-							to.obj.fire( to.eventName, args);--						}, this);--					}, this);--				}, this);--			}, this);--		}, this);--	}--	var passes = {},-		currentEvent = null;---	// Return medaitor api as module definition-	return {--		/**-		* Registers the source subject subscriber and its event(s)-		* @param subscribee {Object}-		* @param eventName {String}-		* @return {this}-		*/--		from: function (subscribee, eventName) {--			if (!arguments.length) {--				throw {-					name: "NoArgumentsException",-					message: "From cannot be called with no arguments"-				};--			}--			currentEvent = eventName || 'all';--			if ( !passes[ currentEvent ] ) {-				passes[ currentEvent ] = {};-			}--			if ( !passes[ currentEvent ].from ) {-				passes[ currentEvent ].from = [];-			}--			add( "from", subscribee, eventName );--			if ( this.removing ) {--				// Has to object been marked for removal??-				each( passes, function ( pass, j ) {--					each( pass.to, function ( to, i) {--						if (pass.to[i].remove && pass.to[i].remove === true) {-							// Dedlete the target object and event,-							// null the currentEvent-							delete passes[j].to[i];-							currentEvent = null;--						}--					}, this);--				}, this);--				this.removing = false;-			}-			// Make it chainable-			return this;--		},---		/**-		* Adds a target subscriber by eventName to the mediator-		* @param subscriber {Object}-		* @param eventName {String}-		* @return {this}-		*/-		to: function ( subscriber, eventName ) {--			if ( !currentEvent ) {--				throw {-					name: "ToFunctionBadUsage",-					message: "Cannot call to before from."-				};--			}--			if ( !passes[ currentEvent ].to ) {-				passes[ currentEvent ].to = [];-			}--			add( "to", subscriber, eventName );--			// No config object parameter-			this.register();--			// Make it chainable-			return this;-		},--		/**-		* Marks target and eventName for removal-		* @param target {Object}-		* @param eventName {String}-		* @return {this}-		*/-		remove: function (obj, eventName) {--			if (!arguments.length) {--				throw {-					name: "NoArgumentException",-					message: "Remove cannot be called without arguments"-				};--			}--			this.removing = true;--			each(passes, function ( pass ) {--				each( pass.to, function ( to, i ) {--					if (typeof obj == "string") {--						eventName = obj;--						if ( to.eventName === eventName ) {--							[].splice.call(pass.to, i, 1);--						}--					} else {--						if ( ( isEqual(to.obj, obj) || obj == null ) && ( to.eventName === eventName || typeof eventName == "undefined" ) ) {--							to.remove = true;--						}--					}--				});--			});--			return this;--		},--		/**-		* Registers the source and target subscriber objects and their events for binding-		* @param optional config Object-		*/-		register: function () {--			var config = arguments[0];--			if ( config ) {--				if ( config.source ) {--					each(config.source, function ( from ) {--						this.from( from.subscriber, from.event );--					}, this);--				} else {--					throw {-						name: "ConfigSourceNotDefined",-						message: "Config object needs a source defined."-					};--				}--				if ( config.target ) {--					each( config.target, function (to) {--						this.to( to.subscriber, to.event );--					}, this);--				} else {--					throw {-						name: "ConfigTargetNotDefined",-						message: "Config object needs a target defined."-					};-				}--			} else {-				bind();-			}--		},--		/**-		* Notifies mediator that target and source subscriber and events should be removed.-		* @param config {Object}-		*/-		unregister: function ( config ) {--			if ( !config ) {--				throw {-					name: "NoArgumentException",-					message: "Unregister cannot be called without arguments"-				};--			}--			if ( config ) {--				this.removing = true;--				if ( config.target ) {--					each( config.target, function ( to ) {--					this.remove( to.subscriber, to.event );--					}, this );--				} else {--					throw {-						name: "ConfigTargetNotDefined",-						message: "Config object needs a target defined."-					};--				}--				if ( config.source ) {--					each(config.source, function (from) {--						this.from(from.subscriber, from.eventName);--					}, this );--				} else {--					throw {-						name: "ConfigSourceNotDefined",-						message: "Config object needs a source defined."-					};--				}--			}--		}--	};--});\ No newline at end of file+define( function ( ) {    /**        * A little helper to remove duplication        * @param type {String} to|from        * @param obj {Object}        * @param eventName {String}        * @private        */    function add (type, obj, eventName) {        passes[ currentEvent ][ type ].push({            obj: obj,            eventName: eventName        });    }    function isEqual (a, b) {        if (a === b) {            return a !== 0 || 1 / a === 1 / b;        }        if (a === null || b === null) {            return a === b;        }        if (Object.prototype.toString.call(a) !== Object.prototype.toString.call(b)) {            return false;        }    }    // Polyfill for nativeForEach    function each (list, callback, context) {        var i;        // Native forEach        if (typeof Array.prototype.forEach == "function" && list.length) {            list.forEach( callback, context || this);        } else if ( list.length ) {            // Polyfill            Array.prototype.forEach = function( callback, context ) {                for (var i = 0, len = list.length; i < len; ++i) {                    callback.call(context, list[i], i, list);                }            };        } else {            // If the list is an [object Object] (i.e. Not an Array)            for ( i in list ) {                if ( list.hasOwnProperty( i ) ) {                    callback.call( context || this, list[i], i, list );                }            }        }    }    /**    * Bind one or more target events to one or more source events    * @private    */    function bind () {        each( passes[ currentEvent ], function (sources, type, passes) {            each( passes, function ( sources, type, pass ) {                each( pass.from, function ( from ) {                    // Remove any previous binding                    from.obj.off( from.eventName );                    // Bind the event to a callback                    from.obj.on( from.eventName, function( args ) {                        each( pass.to, function ( to ) {                            // The callback binds the |to| event                            to.obj.fire( to.eventName, args);                        }, this);                    }, this);                }, this);            }, this);        }, this);    }    var passes = {},        currentEvent = null;    // Return medaitor api as module definition    return {        /**        * Registers the source subject subscriber and its event(s)        * @param subscribee {Object}        * @param eventName {String}        * @return {this}        */        from: function (subscribee, eventName) {            if (!arguments.length) {                throw {                    name: "NoArgumentsException",                    message: "From cannot be called with no arguments"                };            }            currentEvent = eventName || 'all';            if ( !passes[ currentEvent ] ) {                passes[ currentEvent ] = {};            }            if ( !passes[ currentEvent ].from ) {                passes[ currentEvent ].from = [];            }            add( "from", subscribee, eventName );            if ( this.removing ) {                // Has to object been marked for removal??                each( passes, function ( pass, j ) {                    each( pass.to, function ( to, i) {                        if (pass.to[i].remove && pass.to[i].remove === true) {                            // Dedlete the target object and event,                            // null the currentEvent                            delete passes[j].to[i];                            currentEvent = null;                        }                    }, this);                }, this);                this.removing = false;            }            // Make it chainable            return this;        },        /**        * Adds a target subscriber by eventName to the mediator        * @param subscriber {Object}        * @param eventName {String}        * @return {this}        */        to: function ( subscriber, eventName ) {            if ( !currentEvent ) {                throw {                    name: "ToFunctionBadUsage",                    message: "Cannot call to before from."                };            }            if ( !passes[ currentEvent ].to ) {                passes[ currentEvent ].to = [];            }            add( "to", subscriber, eventName );            // No config object parameter            this.register();            // Make it chainable            return this;        },        /**        * Marks target and eventName for removal        * @param target {Object}        * @param eventName {String}        * @return {this}        */        remove: function (obj, eventName) {            if (!arguments.length) {                throw {                    name: "NoArgumentException",                    message: "Remove cannot be called without arguments"                };            }            this.removing = true;            each(passes, function ( pass ) {                each( pass.to, function ( to, i ) {                    if (typeof obj == "string") {                        eventName = obj;                        if ( to.eventName === eventName ) {                            [].splice.call(pass.to, i, 1);                        }                    } else {                        if ( ( isEqual(to.obj, obj) || obj == null ) && ( to.eventName === eventName || typeof eventName == "undefined" ) ) {                            to.remove = true;                        }                    }                });            });            return this;        },        /**        * Registers the source and target subscriber objects and their events for binding        * @param optional config Object        */        register: function () {            var config = arguments[0];            if ( config ) {                if ( config.source ) {                    each(config.source, function ( from ) {                        this.from( from.subscriber, from.event );                    }, this);                } else {                    throw {                        name: "ConfigSourceNotDefined",                        message: "Config object needs a source defined."                    };                }                if ( config.target ) {                    each( config.target, function (to) {                        this.to( to.subscriber, to.event );                    }, this);                } else {                    throw {                        name: "ConfigTargetNotDefined",                        message: "Config object needs a target defined."                    };                }            } else {                bind();            }        },        /**        * Notifies mediator that target and source subscriber and events should be removed.        * @param config {Object}        */        unregister: function ( config ) {            if ( !config ) {                throw {                    name: "NoArgumentException",                    message: "Unregister cannot be called without arguments"                };            }            if ( config ) {                this.removing = true;                if ( config.target ) {                    each( config.target, function ( to ) {                    this.remove( to.subscriber, to.event );                    }, this );                } else {                    throw {                        name: "ConfigTargetNotDefined",                        message: "Config object needs a target defined."                    };                }                if ( config.source ) {                    each(config.source, function (from) {                        this.from(from.subscriber, from.eventName);                    }, this );                } else {                    throw {                        name: "ConfigSourceNotDefined",                        message: "Config object needs a source defined."                    };                }            }        }    };});\ No newline at end of file
utils mixin with base, updated usages of utils....# Please enter the commit message for your changes. Lines starting# with '#' will be ignored, and an empty message aborts the commit.# On branch master# Your branch is ahead of 'origin/master' by 5 commits.#   (use "git push" to publish your local commits)## Changes to be committed:#   (use "git reset HEAD <file>..." to unstage)##	modified:   spec/View.spec.js#	modified:   src/Base.js#	modified:   src/Model.js#	modified:   src/View.js## Changes not staged for commit:#   (use "git add <file>..." to update what will be committed)#   (use "git checkout -- <file>..." to discard changes in working directory)##	modified:   src/utils.js#diff --git spec/View.spec.js spec/View.spec.jsindex 3bd5fa7..85fa969 100644--- spec/View.spec.js+++ spec/View.spec.js@@ -1,4 +1,4 @@-require( ['Base', 'View'], function ( Base, View ) {+require( ['View'], function ( View ) { 	describe("View", function () { 		var view = null;diff --git src/Base.js src/Base.jsindex 70b4ad2..4c3f32d 100644--- src/Base.js+++ src/Base.js@@ -1,4 +1,4 @@-define( ['events'], function ( events ) {+define( ['events', 'utils'], function ( events, utils ) {   /**    * @constructor@@ -15,7 +15,7 @@ define( ['events'], function ( events ) {     }     // Call the start function to do any setup-    if ( "function" == typeof this.start ) {+    if ( utils.isFunction(this.start) ) {       this.start( options );     }@@ -37,7 +37,7 @@ define( ['events'], function ( events ) {       // Iterate over all src properties       for (prop in src) {         if (src.hasOwnProperty(prop)) {-          if ( "object" === typeof src[prop] ) {+          if ( utils.isObject(src[prop])  ) {             dest[prop] = dest[prop] || src[prop];             Base.mixin(dest[prop], src[prop]);           } else {@@ -91,6 +91,8 @@ define( ['events'], function ( events ) {   // properties of events;   Base.mixin(Base.prototype, events);+  Base.mixin(Base, utils);+   // Return Base as the module definition   return Base;diff --git src/Model.js src/Model.jsindex 2a538bf..77cda7c 100644--- src/Model.js+++ src/Model.js@@ -33,7 +33,7 @@ define( ['Base'], function ( Base ) {         },         set: function ( name, value ) {-            if (typeof name == 'string') {+            if ( Base.isString(name) ) {                 this.properties[ name ] = value;             } else {                 for (var n in name) {diff --git src/View.js src/View.jsindex 94e7328..2ee9e71 100644--- src/View.js+++ src/View.js@@ -1 +1 @@-define ( ['Base', 'utils'], function ( Base, utils ) {    var TAGNAME = 'div';    function getRootNode () {        return document.getElementsByTagName("body")[0];    }    // Build the constructor    return Base.construct({        // Start is optional, it's called if present,        // like a constructor        start: function () {            // Option properties override view properties            this.tagName = this.options ? this.options.tagName : TAGNAME;            this.rootNode = this.options ? this.options.rootNode : getRootNode();        },        /**         * Make a Tag         */        make: function () {            // All arguments are optional            var args = [].slice.call(arguments),                name = args[0] || this.tagName,                contents = args[1],                attrs = args[2],                i,                attr,                tag = document.createElement(name);            if (args.length === 2 && utils.isObject(contents)) {                contents = undefined;                attrs = args[1];            }            // Add the contents            if (typeof contents !== "undefined") {                if (utils.isNumber(contents) || utils.isString(contents)) {                    // If the contents is a Number or a String,                    // parse it to a textnode                    contents = document.createTextNode(contents);                }                if (utils.isArray(contents)) {                    // If our contents is an array,                    // append each one to the tag                    while ( i = contents.shift() ) {                        tag.appendChild(i);                    }                } else {                    tag.appendChild(contents);                }            }            // Add the attributes            if ( attrs ) {                for ( attr in attrs ) {                    if (attrs.hasOwnProperty( attr )) {                        // Add each attribute to the tag                        tag[ attr ] = attrs[ attr ];                        if ( !( attr in tag.attributes ) ) {                            // If the attribute wasnt't successfully added,                            // try again with setAttribute                            tag.setAttribute( attr, attrs[ attr ] );                        }                    }                }            }            // Finally return the new tag            return tag;        }    });});\ No newline at end of file+define (['Base'], function ( Base ) {    var TAGNAME = 'div';    function getRootNode () {        return document.getElementsByTagName("body")[0];    }    // Build the constructor    return Base.construct({        // Start is optional, it's called if present,        // like a constructor        start: function () {            // Option properties override view properties            this.tagName = this.options ? this.options.tagName : TAGNAME;            this.rootNode = this.options ? this.options.rootNode : getRootNode();        },        /**         * Make a Tag         */        make: function () {            // All arguments are optional            var args = [].slice.call(arguments),                name = args[0] || this.tagName,                contents = args[1],                attrs = args[2],                i,                attr,                tag = document.createElement(name);            if (args.length === 2 && Base.isObject(contents)) {                contents = undefined;                attrs = args[1];            }            // Add the contents            if (typeof contents !== "undefined") {                if (Base.isNumber(contents) || Base.isString(contents)) {                    // If the contents is a Number or a String,                    // parse it to a textnode                    contents = document.createTextNode(contents);                }                if (Base.isArray(contents)) {                    // If our contents is an array,                    // append each one to the tag                    while ( i = contents.shift() ) {                        tag.appendChild(i);                    }                } else {                    tag.appendChild(contents);                }            }            // Add the attributes            if ( attrs ) {                for ( attr in attrs ) {                    if (attrs.hasOwnProperty( attr )) {                        // Add each attribute to the tag                        tag[ attr ] = attrs[ attr ];                        if ( !( attr in tag.attributes ) ) {                            // If the attribute wasnt't successfully added,                            // try again with setAttribute                            tag.setAttribute( attr, attrs[ attr ] );                        }                    }                }            }            // Finally return the new tag            return tag;        }    });});\ No newline at end of file
utils isfunction