lib/ProfileObject.js
function(name, specs) {
	this.name = name;
	this.id = 0;
	this.properties = specs.properties || [];
	this.extends = specs.extends || null;
	this.depends = specs.depends || null;
	this.factory = specs.factory || "new";
	this.init = specs.init || "default";
	this.frequent = false;
	this.keepUsedProperties = false;
	this.initProperties = true;
	this.initConstructorArgs = [];
	this.propCustomAssign = {};
	this.propAssign = "";
	this.propCustomGet = {};
	this.propGet = "";
	this.postInit = specs.postInit || "";
	this.embed = specs.embed || [];
	if (this.postInit) this.postInit += "\n";

	// Calculate a safe name
	this.safeName = name.replace(/[,\.\- \_]/g, '_');

	// Change init to 'constructor' if init is array
	if (this.init instanceof Array) {
		this.initConstructorArgs = this.init;
		this.init = "constructor";
		this.factory = "create"
	} else if (this.init instanceof {}.constructor) {
		this.propCustomAssign = this.init;
		this.init = "default";

		// Extract default
		if (this.propCustomAssign['default']) {
			this.propAssign = this.propCustomAssign['default'];
			delete this.propCustomAssign['default'];
		}

	} else if (this.init !== "default") {
		// Custom user init function
		if (this.factory === "new")
			this.factory = "create";
	}

	// Check if we have custom property getters
	if (specs.getter) {
		if (typeof specs == 'object') {
			this.propCustomGet = specs.getter;

			// Extract default
			if (this.propCustomGet['default']) {
				this.propGet = this.propCustomGet['default'];
				delete this.propCustomGet['default'];
			}

		} else {
			this.propGet = specs.getter;
		}
	}

	// Initialize boolean fields
	if (specs.frequent !== undefined) {
		this.frequent = (["yes","true","1"].indexOf(specs.frequent.toString().toLowerCase()) >= 0);
	}
	if (specs.initProperties !== undefined) {
		this.initProperties = (["yes","true","1"].indexOf(specs.initProperties.toString().toLowerCase()) >= 0);
	}
	if (specs.keepUsedProperties !== undefined) {
		this.keepUsedProperties = (["yes","true","1"].indexOf(specs.keepUsedProperties.toString().toLowerCase()) >= 0);
	}

}
function(name, specs) {
	this.name = name;
	this.id = 0;
	this.properties = specs.properties || [];
	this.extends = specs.extends || null;
	this.depends = specs.depends || null;
	this.factory = specs.factory || "new";
	this.init = specs.init || "default";
	this.frequent = false;
	this.keepUsedProperties = false;
	this.initProperties = true;
	this.initConstructorArgs = [];
	this.propCustomAssign = {};
	this.propAssign = "";
	this.propCustomGet = {};
	this.propGet = "";
	this.postInit = specs.postInit || "";
	this.embed = specs.embed || [];
	if (this.postInit) this.postInit += "\n";

	// Calculate a safe name
	this.safeName = name.replace(/[,\.\- \_]/g, '_');

	// Change init to 'constructor' if init is array
	if (this.init instanceof Array) {
		this.initConstructorArgs = this.init;
		this.init = "constructor";
		this.factory = "create"
	} else if (this.init instanceof {}.constructor) {
		this.propCustomAssign = this.init;
		this.init = "default";

		// Extract default
		if (this.propCustomAssign['default']) {
			this.propAssign = this.propCustomAssign['default'];
			delete this.propCustomAssign['default'];
		}

	} else if (this.init !== "default") {
		// Custom user init function
		if (this.factory === "new")
			this.factory = "create";
	}

	// Check if we have custom property getters
	if (specs.getter) {
		if (typeof specs == 'object') {
			this.propCustomGet = specs.getter;

			// Extract default
			if (this.propCustomGet['default']) {
				this.propGet = this.propCustomGet['default'];
				delete this.propCustomGet['default'];
			}

		} else {
			this.propGet = specs.getter;
		}
	}

	// Initialize boolean fields
	if (specs.frequent !== undefined) {
		this.frequent = (["yes","true","1"].indexOf(specs.frequent.toString().toLowerCase()) >= 0);
	}
	if (specs.initProperties !== undefined) {
		this.initProperties = (["yes","true","1"].indexOf(specs.initProperties.toString().toLowerCase()) >= 0);
	}
	if (specs.keepUsedProperties !== undefined) {
		this.keepUsedProperties = (["yes","true","1"].indexOf(specs.keepUsedProperties.toString().toLowerCase()) >= 0);
	}

}
A representation of an object in the profile