<commit_before>var _ = require('lodash');
var Router = require('director').Router;

var RoutesAction = require('../actions/routes');
var RoutesStore = require('../stores/routes');

var router;

module.exports = {
  back: function() {
    var stacks = RoutesStore.getStacks();
    if (stacks.length > 1) {
      router.setRoute(stacks[stacks.length - 2]);
    }
  },

  navigateTo: function(path) {
    router.setRoute(path);
  },

  create: function(routes, options) {
    var originalOn = options && options.on;
    var on = [function() {
      RoutesAction.navigateTo(router.getRoute().join('/'));
    }];
    if (_.isFunction(originalOn)) {
      on.push(originalOn);
    } else if (_.isArray(originalOn)) {
      on = on.concat(originalOn);
    }
    router = new Router(routes).configure(_.merge({}, options, {on: on}));
    router.init('/');
    return router;
  }
};<commit_msg>correct route<commit_after>var _ = require('lodash');
var Router = require('director').Router;

var RoutesAction = require('../actions/routes');
var RoutesStore = require('../stores/routes');

var router;

module.exports = {
  back: function() {
    var stacks = RoutesStore.getStacks();
    if (stacks.length > 1) {
      router.setRoute(stacks[stacks.length - 2]);
    }
  },

  navigateTo: function(path) {
    router.setRoute(path);
  },

  create: function(routes, options) {
    var originalOn = options && options.on;
    var on = [function() {
      RoutesAction.navigateTo('/' + router.getRoute().join('/'));
    }];
    if (_.isFunction(originalOn)) {
      on.push(originalOn);
    } else if (_.isArray(originalOn)) {
      on = on.concat(originalOn);
    }
    router = new Router(routes).configure(_.merge({}, options, {on: on}));
    router.init('/');
    return router;
  }
};
{'fraction_non_alphanumeric': 0.17905405405405406, 'fraction_numerical': 0.0022522522522522522, 'mean_word_length': 3.261390887290168, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '5345311', 'n_tokens_mistral': 592, 'n_tokens_neox': 589, 'n_words': 112}