lib/json-dry.js
function findClass(value) {

	var constructor,
	    ns;

	// Return nothing for falsy values
	if (!value) {
		return null;
	}

	// Look for a regular class when it's just a string
	if (typeof value == 'string') {

		if (exports.Classes[value]) {
			return exports.Classes[value];
		}

		return null;
	}

	if (value.path) {
		return fromPath(exports.Classes, value.path);
	} else {
		if (value.namespace) {
			ns = fromPath(exports.Classes, value.namespace);
		} else {
			ns = exports.Classes;
		}

		if (value.dry_class) {
			constructor = fromPath(ns, value.dry_class);
		} else if (value.name) {
			constructor = ns[value.name];
		}

		if (!constructor && ns) {
			if (ns.main_class) {
				ns = ns.main_class;
			}

			if (ns && typeof ns.getClassForUndry == 'function') {
				constructor = ns.getClassForUndry(value.dry_class || value.name);
			}
		}
	}

	if (!constructor) {
		console.log('Could not find constructor for', value);
	}

	return constructor;
}
function findClass(value) {

	var constructor,
	    ns;

	// Return nothing for falsy values
	if (!value) {
		return null;
	}

	// Look for a regular class when it's just a string
	if (typeof value == 'string') {

		if (exports.Classes[value]) {
			return exports.Classes[value];
		}

		return null;
	}

	if (value.path) {
		return fromPath(exports.Classes, value.path);
	} else {
		if (value.namespace) {
			ns = fromPath(exports.Classes, value.namespace);
		} else {
			ns = exports.Classes;
		}

		if (value.dry_class) {
			constructor = fromPath(ns, value.dry_class);
		} else if (value.name) {
			constructor = ns[value.name];
		}

		if (!constructor && ns) {
			if (ns.main_class) {
				ns = ns.main_class;
			}

			if (ns && typeof ns.getClassForUndry == 'function') {
				constructor = ns.getClassForUndry(value.dry_class || value.name);
			}
		}
	}

	if (!constructor) {
		console.log('Could not find constructor for', value);
	}

	return constructor;
}
function findClass ( value ) { var constructor , ns ; // Return nothing for falsy values if ( ! value ) { return null ; } // Look for a regular class when it's just a string if ( typeof value == 'string' ) { if ( exports . Classes [ value ] ) { return exports . Classes [ value ] ; } return null ; } if ( value . path ) { return fromPath ( exports . Classes , value . path ) ; } else { if ( value . namespace ) { ns = fromPath ( exports . Classes , value . namespace ) ; } else { ns = exports . Classes ; } if ( value . dry_class ) { constructor = fromPath ( ns , value . dry_class ) ; } else if ( value . name ) { constructor = ns [ value . name ] ; } if ( ! constructor && ns ) { if ( ns . main_class ) { ns = ns . main_class ; } if ( ns && typeof ns . getClassForUndry == 'function' ) { constructor = ns . getClassForUndry ( value . dry_class || value . name ) ; } } } if ( ! constructor ) { console . log ( 'Could not find constructor for' , value ) ; } return constructor ; }
Find a class

@author   Jelle De Loecker   <jelle@develry.be>
@since    1.0.0
@version  1.0.9

@param    {String}   value   The name of the class
Find a class