<commit_before>require.config({
  baseUrl: 'src/js',
  paths: {
    jquery: '//code.jquery.com/jquery-2.1.4',
    bootstrap: '//netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap',
    jui: '//rawgit.com/seogi1004/jui/develop/dist/jui'
  },
  shim: {
    bootstrap: ['jquery'],
    jui : ['jquery']
  },
  packages: [{
    name: 'summernote',
    main: 'summernote',
    location: './'
  }]
});

require([
  'jquery',
  'summernote'
], function ($) {
  // editor type setting
  switch ($('script[data-editor-type]').data('editor-type')) {
    case 'lite':
      require(['summernote/lite/settings'], function (lite) {
        $.summernote = $.extend($.summernote, lite);
        // initialize summernote
        $('.summernote').summernote({
          height: 300
        });
      });
      break;
    case 'bs3':
      require(['bootstrap', 'summernote/bs3/settings'], function (bootstrap, bs3) {
        $.summernote = $.extend($.summernote, bs3);
        // initialize summernote
        $('.summernote').summernote({
          height: 300
        });
      });
      break;
    case 'jui':
      require(['jui', 'summernote/jui/settings'], function (jui, settings) {
        $.summernote = $.extend($.summernote, settings);
        // initialize summernote
        $('.summernote').summernote({
          height: 300
        });
      });
      break;
  }
});
<commit_msg>Refactor remove duplicated init code.<commit_after>require.config({
  baseUrl: 'src/js',
  paths: {
    jquery: '//code.jquery.com/jquery-2.1.4',
    bootstrap: '//netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap',
    jui: '//rawgit.com/seogi1004/jui/develop/dist/jui'
  },
  shim: {
    bootstrap: ['jquery'],
    jui : ['jquery']
  },
  packages: [{
    name: 'summernote',
    main: 'summernote',
    location: './'
  }]
});

require([
  'jquery',
  'summernote'
], function ($) {
  var requireByPromise = function (paths) {
    return $.Deferred(function (deferred) {
      require(paths, function () {
        deferred.resolve.apply(this, arguments);
      });
    });
  };

  var promise = $.Deferred();
  // editor type setting
  switch ($('script[data-editor-type]').data('editor-type')) {
    case 'lite':
      promise = requireByPromise(['summernote/lite/settings']).then(function (lite) {
        $.summernote = $.extend($.summernote, lite);
      });
      break;
    case 'bs3':
      promise = requireByPromise(['bootstrap', 'summernote/bs3/settings']).then(function (bootstrap, bs3) {
        $.summernote = $.extend($.summernote, bs3);
      });
      break;
    case 'jui':
      promise = requireByPromise(['jui', 'summernote/jui/settings']).then(function (j, jui) {
        $.summernote = $.extend($.summernote, jui);
      });
      break;
  }

  promise.then(function () {
    // initialize summernote
    $('.summernote').summernote({
      height: 300
    });
  });
});

{'fraction_non_alphanumeric': 0.19214732453092426, 'fraction_numerical': 0.01389854065323141, 'mean_word_length': 2.528186274509804, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3044262', 'n_tokens_mistral': 1004, 'n_tokens_neox': 934, 'n_words': 161}