<commit_before>var helpers = {

  // USER HELPERS
  getUsername: function(_id) {

    var user = Meteor.users.findOne(_id);

    return user && user.profile.name;

  },

  getFullname: function(_id) {

    var user = Meteor.users.findOne(_id);

    return user && user.fullname;

  },

  // APP HELPERS

  apps: function(genre, skip, limit) {

    var options = {sort: {installCount: -1}};
    if (skip) options.skip = skip;
    if (limit) options.limit = limit;

    return Genres.findIn(genre, {}, options);

  },

  appsCount: function(genre, skip, limit) {

    var options = {sort: {installCount: -1}};
    if (!AppMarket.isBlankKeyword(skip)) options.skip = skip;
    if (!AppMarket.isBlankKeyword(limit)) options.limit = limit;

    return Genres.findIn(genre, {}, options).count();

  },

  ratingsCount: function() {
    
    var aggregateReview = AggregateReviews.findOne({appId: this.appId});
    return aggregateReview ? aggregateReview.ratingsCount : 0;
    
  },

  latestVersionNumber: function(app) {

    app = app || this;
    return app && app.latestVersion && app.latestVersion() && app.latestVersion().number;

  },

  urlHost: function(url) {
    var parser = document.createElement("a");
    parser.href = url;
    return parser.hostname || parser.host
  },

  genreUrl: function(genre) {
    return FlowRouter.path('appMarketGenre', {genre: genre || this});
  },

  indexedList: function(list) {
    var i = 0;
    return list.map(function (v) {
      return {index: i++, value: v};
    });
  },

  approval: Apps.approval,

  appRatings: Reviews.rating,

  appState: function(state) {

    return this.approved === Apps.approval[state];

  },

  // ROUTER/SUB HELPERS
  
  
  subLimit: function() {
    
    return Template.instance().get('subLimit').get();
    
  },

  routerSubsReady: function(name) {

    return name ? FlowRouter.subsReady(name) : FlowRouter.subsReady();

  },

  routeRoot: function(string) {

    FlowRouter.watchPathChange();
    return FlowRouter.current().path.substr(0, string && string.length) === string ?
          'active' : '';

  },

  routeCategory: function(routeName) {

    routeName = cleanArgs(routeName);
    return FlowRouter.routeCategories[routeName || FlowRouter.getRouteName()];

  },

  inRouteCategory: function(category, routeName) {

    routeName = cleanArgs(routeName);
    return FlowRouter.routeCategories[routeName || FlowRouter.getRouteName()] === category ?
           'active' :
           '';
  },

  getPath: function(routeName, params, queryParams) {

    params = cleanArgs(params);
    queryParams = cleanArgs(queryParams);
    return FlowRouter.path(routeName, params, queryParams);

  },

  getZippedPath: function(routeName, paramKeys, paramVals, queryParamKeys, queryParamVals) {

    paramKeys = cleanArgs(paramKeys);
    paramVals = cleanArgs(paramVals);
    queryParamKeys = cleanArgs(queryParamKeys);
    queryParamVals = cleanArgs(queryParamVals);
    params = _.object([].concat(paramKeys), [].concat(paramVals));
    queryParams = _.object([].concat(queryParamKeys), [].concat(queryParamVals));
    return FlowRouter.path(routeName, params, queryParams);

  },

  getParam: function(param) {

    return FlowRouter.getParam(param);

  },

  sandstormHost: function() {

    return amplify.store('sandstormHost');

  },

  fullInstallLink: function() {

    AppMarket.hostDep.depend();

    var host = AppMarket.sandstormHost;
    if (!host) {
      if (AppMarket.hasSandstormHost()) {
        // The user arrived with no explicit host, but we have recorded this user using a specific
        // host before. So, leave the href blank as this will cause the host chooser to appear if
        // they click.
        return "";
      } else {
        // This user has no hosts that we know of. Suggest a demo on Oasis.
        host = "https://oasis.sandstorm.io/";
      }
    }

    return this.packageId ?
           [
             host,
             'install/',
             this.packageId,
             '?url=',
             Api.packageUrl(this.packageId)
           ].join('') : '';

  },

  // VALIDATION HELPERS

  validate: function(field) {

    var tmp = Template.instance(),
        validator = tmp.get('validator');

    return !!_.findWhere(validator.invalidKeys(), {name: field});

  },

  // UTILITY HELPERS
<commit_msg>Demo server is now Alpha, not Oasis.<commit_after>var helpers = {

  // USER HELPERS
  getUsername: function(_id) {

    var user = Meteor.users.findOne(_id);

    return user && user.profile.name;

  },

  getFullname: function(_id) {

    var user = Meteor.users.findOne(_id);

    return user && user.fullname;

  },

  // APP HELPERS

  apps: function(genre, skip, limit) {

    var options = {sort: {installCount: -1}};
    if (skip) options.skip = skip;
    if (limit) options.limit = limit;

    return Genres.findIn(genre, {}, options);

  },

  appsCount: function(genre, skip, limit) {

    var options = {sort: {installCount: -1}};
    if (!AppMarket.isBlankKeyword(skip)) options.skip = skip;
    if (!AppMarket.isBlankKeyword(limit)) options.limit = limit;

    return Genres.findIn(genre, {}, options).count();

  },

  ratingsCount: function() {
    
    var aggregateReview = AggregateReviews.findOne({appId: this.appId});
    return aggregateReview ? aggregateReview.ratingsCount : 0;
    
  },

  latestVersionNumber: function(app) {

    app = app || this;
    return app && app.latestVersion && app.latestVersion() && app.latestVersion().number;

  },

  urlHost: function(url) {
    var parser = document.createElement("a");
    parser.href = url;
    return parser.hostname || parser.host
  },

  genreUrl: function(genre) {
    return FlowRouter.path('appMarketGenre', {genre: genre || this});
  },

  indexedList: function(list) {
    var i = 0;
    return list.map(function (v) {
      return {index: i++, value: v};
    });
  },

  approval: Apps.approval,

  appRatings: Reviews.rating,

  appState: function(state) {

    return this.approved === Apps.approval[state];

  },

  // ROUTER/SUB HELPERS
  
  
  subLimit: function() {
    
    return Template.instance().get('subLimit').get();
    
  },

  routerSubsReady: function(name) {

    return name ? FlowRouter.subsReady(name) : FlowRouter.subsReady();

  },

  routeRoot: function(string) {

    FlowRouter.watchPathChange();
    return FlowRouter.current().path.substr(0, string && string.length) === string ?
          'active' : '';

  },

  routeCategory: function(routeName) {

    routeName = cleanArgs(routeName);
    return FlowRouter.routeCategories[routeName || FlowRouter.getRouteName()];

  },

  inRouteCategory: function(category, routeName) {

    routeName = cleanArgs(routeName);
    return FlowRouter.routeCategories[routeName || FlowRouter.getRouteName()] === category ?
           'active' :
           '';
  },

  getPath: function(routeName, params, queryParams) {

    params = cleanArgs(params);
    queryParams = cleanArgs(queryParams);
    return FlowRouter.path(routeName, params, queryParams);

  },

  getZippedPath: function(routeName, paramKeys, paramVals, queryParamKeys, queryParamVals) {

    paramKeys = cleanArgs(paramKeys);
    paramVals = cleanArgs(paramVals);
    queryParamKeys = cleanArgs(queryParamKeys);
    queryParamVals = cleanArgs(queryParamVals);
    params = _.object([].concat(paramKeys), [].concat(paramVals));
    queryParams = _.object([].concat(queryParamKeys), [].concat(queryParamVals));
    return FlowRouter.path(routeName, params, queryParams);

  },

  getParam: function(param) {

    return FlowRouter.getParam(param);

  },

  sandstormHost: function() {

    return amplify.store('sandstormHost');

  },

  fullInstallLink: function() {

    AppMarket.hostDep.depend();

    var host = AppMarket.sandstormHost;
    if (!host) {
      if (AppMarket.hasSandstormHost()) {
        // The user arrived with no explicit host, but we have recorded this user using a specific
        // host before. So, leave the href blank as this will cause the host chooser to appear if
        // they click.
        return "";
      } else {
        // This user has no hosts that we know of. Suggest a demo on Alpha.
        host = "https://alpha.sandstorm.io/";
      }
    }

    return this.packageId ?
           [
             host,
             'install/',
             this.packageId,
             '?url=',
             Api.packageUrl(this.packageId)
           ].join('') : '';

  },

  // VALIDATION HELPERS

  validate: function(field) {

    var tmp = Template.instance(),
        validator = tmp.get('validator');

    return !!_.findWhere(validator.invalidKeys(), {name: field});

  },

  // UTILITY HELPERS

{'fraction_non_alphanumeric': 0.13635840147414488, 'fraction_numerical': 0.0011516756881262238, 'mean_word_length': 2.9329710144927534, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4308864', 'n_tokens_mistral': 2794, 'n_tokens_neox': 2624, 'n_words': 584}