archive/v1/format.js
function format(response) {

		var newObj = [];
		var objects = _.get(response, 'objects') || response;
		
		if (objects) {

			// check if objects is an array
			if (Array.isArray(objects)) {
				_.forEach(objects, function(obj) {
					newObj.push(expandFields(formatProp(obj)));
				});
			}
			else {
				newObj = expandFields(formatProp(objects));
			}
			return newObj;
		}

		// if no objects return the raw response
		return response;
	}
function format(response) {

		var newObj = [];
		var objects = _.get(response, 'objects') || response;
		
		if (objects) {

			// check if objects is an array
			if (Array.isArray(objects)) {
				_.forEach(objects, function(obj) {
					newObj.push(expandFields(formatProp(obj)));
				});
			}
			else {
				newObj = expandFields(formatProp(objects));
			}
			return newObj;
		}

		// if no objects return the raw response
		return response;
	}
function format ( response ) { var newObj = [ ] ; var objects = _ . get ( response , 'objects' ) || response ; if ( objects ) { // check if objects is an array if ( Array . isArray ( objects ) ) { _ . forEach ( objects , function ( obj ) { newObj . push ( expandFields ( formatProp ( obj ) ) ) ; } ) ; } else { newObj = expandFields ( formatProp ( objects ) ) ; } return newObj ; } // if no objects return the raw response return response ; }
main formatting function
main formatting function