text: var Class = require('../../ext/Class');
  
  var FacetService = require('./FacetService');
  
  /**
   * A facet service that passes the listService (generated by a delegate)
   * to a given function
   */
  var FacetServiceFn = Class.create(FacetService, {
      initialize: function(facetService, fn) {
          this.facetService = facetService;
          this.fn = fn;
      },
  
      prepareListService: function(pathHead) {
          var self = this;
          var result = this.facetService.prepareListService(pathHead).then(function(ls) {
              var r = self.fn(ls);
              return r;
          });
  
          return result;
      },
  
  });
  
  module.exports = FacetServiceFn;
  