lib/json-dry.js
function fromPath(obj, path) {

	var pieces,
	    here,
	    len,
	    i;

	if (typeof path == 'string') {
		pieces = path.split('.');
	} else {
		pieces = path;
	}

	here = obj;

	// Go over every piece in the path
	for (i = 0; i < pieces.length; i++) {
		if (here != null) {
			if (here.hasOwnProperty(pieces[i])) {
				here = here[pieces[i]];
			} else {
				return null;
			}
		} else {
			break;
		}
	}

	return here;
}
function fromPath(obj, path) {

	var pieces,
	    here,
	    len,
	    i;

	if (typeof path == 'string') {
		pieces = path.split('.');
	} else {
		pieces = path;
	}

	here = obj;

	// Go over every piece in the path
	for (i = 0; i < pieces.length; i++) {
		if (here != null) {
			if (here.hasOwnProperty(pieces[i])) {
				here = here[pieces[i]];
			} else {
				return null;
			}
		} else {
			break;
		}
	}

	return here;
}
function fromPath ( obj , path ) { var pieces , here , len , i ; if ( typeof path == 'string' ) { pieces = path . split ( '.' ) ; } else { pieces = path ; } here = obj ; // Go over every piece in the path for ( i = 0 ; i < pieces . length ; i ++ ) { if ( here != null ) { if ( here . hasOwnProperty ( pieces [ i ] ) ) { here = here [ pieces [ i ] ] ; } else { return null ; } } else { break ; } } return here ; }
Extract something from an object by the path

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

@param    {Object}    obj
@param    {String}    path

@return   {Mixed}
Extract something from an object by the path