<commit_before>define(['knockout', 'jquery'], function (ko, $) {
  var getContext = function (elementAccessor) {
    var context;
    var element;

    if (!elementAccessor) {
      return;
    }

    element = $(elementAccessor)[0];
    if (!element) {
      return;
    }

    context = ko.contextFor(element);
    if (!context) {
      return;
    }

    return context;
  };

  var getViewModel = function (elementAccessor) {
    var viewModel;
    var context = getContext(elementAccessor);
    if (context) {
      viewModel = context.$data;
    } else {
      viewModel = {};
    }
    return viewModel;
  };

  var getRoot = function () {
    var context;
    var root;

    context = getContext('#globalBody');

    if (!context) {
      return;
    }

    root = context.$root;
    if (!root) {
      return;
    }

    return root;
  };

  return {
    getRoot: getRoot,
    getContext: getContext,
    getViewModel: getViewModel
  };
});<commit_msg>Implement a create function that allows creating a customized module<commit_after>define(['knockout', 'jquery'], function (ko, $) {
  var defaultBodySelector = 'body';

  var createGetContext = function createGetContext () {
    return function getContext (elementAccessor) {
      var context;
      var element;

      if (!elementAccessor) {
        return;
      }

      element = $(elementAccessor)[0];
      if (!element) {
        return;
      }

      context = ko.contextFor(element);
      if (!context) {
        return;
      }

      return context;
    }
  };

  var createGetViewModel = function createGetViewModel () {
    return function getViewModel (elementAccessor) {
      var viewModel;
      var context = getContext(elementAccessor);
      if (context) {
        viewModel = context.$data;
      } else {
        viewModel = {};
      }
      return viewModel;
    };
  };

  var createGetRoot = function createGetRoot (bodySelector) {
    if (typeof bodySelector !== 'string') {
      bodySelector = defaultBodySelector;
    }

    return function getRoot () {
      var context;
      var root;

      context = getContext(bodySelector);

      if (!context) {
        return;
      }

      root = context.$root;
      if (!root) {
        return;
      }

      return root;
    }
  };

  var module = {
    getContext: createGetContext(),
    getRoot: createGetRoot(),
    getViewModel: createGetViewModel()
  }

  module.create = function create (bodySelector) {
    return $.extend({}, module, {
      getRoot: createGetRoot(bodySelector)
    });
  };

  return module;
});
{'fraction_non_alphanumeric': 0.11803661862095832, 'fraction_numerical': 0.0007791195948578107, 'mean_word_length': 2.2796934865900385, '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': '1647689', 'n_tokens_mistral': 761, 'n_tokens_neox': 724, 'n_words': 183}