function composeTransformResponses(transformFn) {
	return function (req, res) {
		var collectionMetadata = {};

		transformResponses(req, res, collectionMetadata);

		if (transformFn) {
			transformFn(req, res, collectionMetadata);
		}

		// Finally send the response to the client (in case it has not been sent yet)
		// See: http://expressjs.com/es/api.html#res.headersSent
		if (!res.headersSent) {
			if (isGetCollectionRequest(req)) {
				res.jsonp({ items: res.locals.data, metadata: collectionMetadata });
			} else {
				res.jsonp(res.locals.data);
			}
		}
	};
}
/**
 * Call all the different Stark default transformations first, then the provided custom transformation (if any) and
 * finally return the final response.
 * @param transformFn {Function} Transform function to be applied to the response. This function should be
 * provided via the "middlewares" parameter in the getJSONServer method.
 * This function will be called with 3 parameters:
 * - Request: the current request
 * - Response: the current response (containing the default changes made by Stark middleware)
 * - StarkMetadata: metadata object constructed by the Stark middleware (only for Collection responses)
 */
Call all the different Stark default transformations first, then the provided custom transformation (if any) and
finally return the final response.
@param transformFn {Function} Transform function to be applied to the response. This function should be
provided via the "middlewares" parameter in the getJSONServer method.
This function will be called with 3 parameters:
- Request: the current request
- Response: the current response (containing the default changes made by Stark middleware)
- StarkMetadata: metadata object constructed by the Stark middleware (only for Collection responses)
Call all the different Stark default transformations first then the provided custom transformation ( if any ) and finally return the final response . @param transformFn { Function } Transform function to be applied to the response . This function should be provided via the " middlewares " parameter in the getJSONServer method . This function will be called with 3 parameters : - Request : the current request - Response : the current response ( containing the default changes made by Stark middleware ) - StarkMetadata : metadata object constructed by the Stark middleware ( only for Collection responses )
function composeTransformResponses(transformFn) {
	return function (req, res) {
		var collectionMetadata = {};
		transformResponses(req, res, collectionMetadata);
		if (transformFn) {
			transformFn(req, res, collectionMetadata);
		}
		if (!res.headersSent) {
			if (isGetCollectionRequest(req)) {
				res.jsonp({ items: res.locals.data, metadata: collectionMetadata });
			} else {
				res.jsonp(res.locals.data);
			}
		}
	};
}
function composeTransformResponses ( transformFn ) { return function ( req , res ) { var collectionMetadata = { } ; transformResponses ( req , res , collectionMetadata ) ; if ( transformFn ) { transformFn ( req , res , collectionMetadata ) ; } if ( ! res . headersSent ) { if ( isGetCollectionRequest ( req ) ) { res . jsonp ( { items : res . locals . data , metadata : collectionMetadata } ) ; } else { res . jsonp ( res . locals . data ) ; } } } ; }
Call all the different Stark default transformations first, then the provided custom transformation (if any) and
 finally return the final response.
Call all the different Stark default transformations first then the provided custom transformation ( if any ) and finally return the final response .
// Finally send the response to the client (in case it has not been sent yet) // See: http://expressjs.com/es/api.html#res.headersSent