index.js
function applyGroupBy(images, options) {
	return Promise.reduce(options.groupBy, function (images, group) {
		return Promise.map(images, function (image) {
			return Promise.resolve(group(image)).then(function (group) {
				if (group) {
					image.groups.push(group);
				}
				return image;
			}).catch(function (image) {
				return image;
			});
		});
	}, images).then(function (images) {
		return [images, options];
	});
}
function applyGroupBy(images, options) {
	return Promise.reduce(options.groupBy, function (images, group) {
		return Promise.map(images, function (image) {
			return Promise.resolve(group(image)).then(function (group) {
				if (group) {
					image.groups.push(group);
				}
				return image;
			}).catch(function (image) {
				return image;
			});
		});
	}, images).then(function (images) {
		return [images, options];
	});
}
function applyGroupBy ( images , options ) { return Promise . reduce ( options . groupBy , function ( images , group ) { return Promise . map ( images , function ( image ) { return Promise . resolve ( group ( image ) ) . then ( function ( group ) { if ( group ) { image . groups . push ( group ) ; } return image ; } ) . catch ( function ( image ) { return image ; } ) ; } ) ; } , images ) . then ( function ( images ) { return [ images , options ] ; } ) ; }
Apply groupBy functions over collection of exported images.
@param  {Object} options
@param  {Array}  images
@return {Promise}
Apply groupBy functions over collection of exported images .