lib/xml2json.js
function setValueForPath(object, path, value, index) {
		index = index || 0;

		if (path.length > index + 1) {
			var obj = object[path[index]];

			// we always want the last object in an array
			if (_.isArray(obj)) obj = _.last(obj);

			setValueForPath(obj, path, value, index + 1);
		} else {
			// found the object so set its value
			object[path[index]] = value;
		}
	}
function setValueForPath(object, path, value, index) {
		index = index || 0;

		if (path.length > index + 1) {
			var obj = object[path[index]];

			// we always want the last object in an array
			if (_.isArray(obj)) obj = _.last(obj);

			setValueForPath(obj, path, value, index + 1);
		} else {
			// found the object so set its value
			object[path[index]] = value;
		}
	}
function setValueForPath ( object , path , value , index ) { index = index || 0 ; if ( path . length > index + 1 ) { var obj = object [ path [ index ] ] ; // we always want the last object in an array if ( _ . isArray ( obj ) ) obj = _ . last ( obj ) ; setValueForPath ( obj , path , value , index + 1 ) ; } else { // found the object so set its value object [ path [ index ] ] = value ; } }
helper function to set the value of a path
helper function to set the value of a path