archive/v1/client/retrieve.js
function getResults(result, objects) {
		
		// if there are no results, resolve an empty array
		if (!result) {
			return new Promise(function(resolve, reject) {
				resolve([]);
			});
		}
		
		// if the result object is undefined or not an array, make it one
		result.objects = result.objects || [];
		result.objects = Array.isArray(result.objects) ? result.objects : [result.objects];
		objects        = _.union(objects, result.objects);
		
		// if the result has a token, there are more results, continue to get them
		if (result.token) {
			return _client.method('ContinueRetrievePropertiesEx', {
				_this: _client._sc.propertyCollector,
				token: result.token
			})
			.then(function(results) {
				return getResults(results, objects);
			});
		}
		
		// if there are no more results, return the formatted results
		else {
			return new Promise(function(resolve, reject) {
				resolve(env.format(objects));
			});
		}
	}
function getResults(result, objects) {
		
		// if there are no results, resolve an empty array
		if (!result) {
			return new Promise(function(resolve, reject) {
				resolve([]);
			});
		}
		
		// if the result object is undefined or not an array, make it one
		result.objects = result.objects || [];
		result.objects = Array.isArray(result.objects) ? result.objects : [result.objects];
		objects        = _.union(objects, result.objects);
		
		// if the result has a token, there are more results, continue to get them
		if (result.token) {
			return _client.method('ContinueRetrievePropertiesEx', {
				_this: _client._sc.propertyCollector,
				token: result.token
			})
			.then(function(results) {
				return getResults(results, objects);
			});
		}
		
		// if there are no more results, return the formatted results
		else {
			return new Promise(function(resolve, reject) {
				resolve(env.format(objects));
			});
		}
	}
function getResults ( result , objects ) { // if there are no results, resolve an empty array if ( ! result ) { return new Promise ( function ( resolve , reject ) { resolve ( [ ] ) ; } ) ; } // if the result object is undefined or not an array, make it one result . objects = result . objects || [ ] ; result . objects = Array . isArray ( result . objects ) ? result . objects : [ result . objects ] ; objects = _ . union ( objects , result . objects ) ; // if the result has a token, there are more results, continue to get them if ( result . token ) { return _client . method ( 'ContinueRetrievePropertiesEx' , { _this : _client . _sc . propertyCollector , token : result . token } ) . then ( function ( results ) { return getResults ( results , objects ) ; } ) ; } // if there are no more results, return the formatted results else { return new Promise ( function ( resolve , reject ) { resolve ( env . format ( objects ) ) ; } ) ; } }
continues to get all properties until finished
continues to get all properties until finished