Factory for building Javascript objects. Good for test fixtures.
<script src="https://raw2.github.com/HackerOfDreams/factory-js/master/dist/factory.min.js"></script>
var note,
Note = function Note() {
this.title = "";
};
Factory.define("note", Note).defaults({title:"A good note"});
note = Factory.build("note");
##Define an Object
Factory.define("type", ConstructorFunction).defaults(defaultObjProperties);
The constructor function is optional
Factory.define("type").defaults(defaultObjProperties);
var foo;
Factory.define("foo").defaults({name:"bar"});
foo = Factory.build("foo");
You can override properties of defined objects
var foo;
Factory.define("foo").defaults({name:"bar"});
foo = Factory.build("foo", {name: "I'm foo"});
Note: If the property doesn't exist, it will be created
var notes;
Factory.define("note", NoteConstructor).defaults({id:0, title: "Note #0"})
.sequence("id")
.sequence("title", function(i) { return "Note #" + i });
notes = Factory.buildList("note", 10);
Cleans the Factory's defined constructors
Factory.clean();