lib/json-dry.js
function getFromOld(old, pieces) {

	var length = pieces.length,
	    result,
	    path,
	    rest,
	    i;

	for (i = 0; i < length; i++) {
		path = pieces.slice(0, length - i).join('.');

		result = old[path];

		if (typeof result != 'undefined') {

			if (i == 0) {
				return result;
			}

			rest = pieces.slice(pieces.length - i);

			result = retrieveFromPath(result, rest);

			if (typeof result != 'undefined') {
				return result;
			}
		}
	}
}
function getFromOld(old, pieces) {

	var length = pieces.length,
	    result,
	    path,
	    rest,
	    i;

	for (i = 0; i < length; i++) {
		path = pieces.slice(0, length - i).join('.');

		result = old[path];

		if (typeof result != 'undefined') {

			if (i == 0) {
				return result;
			}

			rest = pieces.slice(pieces.length - i);

			result = retrieveFromPath(result, rest);

			if (typeof result != 'undefined') {
				return result;
			}
		}
	}
}
function getFromOld ( old , pieces ) { var length = pieces . length , result , path , rest , i ; for ( i = 0 ; i < length ; i ++ ) { path = pieces . slice ( 0 , length - i ) . join ( '.' ) ; result = old [ path ] ; if ( typeof result != 'undefined' ) { if ( i == 0 ) { return result ; } rest = pieces . slice ( pieces . length - i ) ; result = retrieveFromPath ( result , rest ) ; if ( typeof result != 'undefined' ) { return result ; } } } }
Find path in an "old" object

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

@param    {Object}   old      The object to look in
@param    {Array}    pieces   The path to look for

@return   {Mixed}
Find path in an old object