<commit_before>var log = require("/api/Log");
var os = Ti.Platform.osname;


// The TiShadow build of the Titanium SDK does not cache CommonJS modules loaded
// from the applicationDataDirectory. This is so that if an update to the app is
// deployed, i.e. a file in the applicationDataDirectory is modified, the changes
// while be loaded. That said loading a CommonJS module every time that it is loaded
// make the deployed bundle run slowly. So we will manage the caching of those
// modules here in the code.
var cache={};

exports.require = function(base,extension) {
  try {
    // In case of double mapping (if required from variable)
    if (extension.indexOf(base) !== -1) {
      extension = extension.replace(base, "");
    }
    // Full Path
    var path = base + extension;
    //Try platform specific path first
    var platform_path =  base + (os === "android" ? "android" : "iphone") + "/" + extension;
    var file = Ti.Filesystem.getFile(platform_path + ".js");
    if (file.exists()) {
      path = platform_path;   
    }
    // Is the CommonJS module in the cache
    if (cache[path]) {
      return cache[path];
    }
    var mod;
    if (os === "android") {
      mod = require(require("com.yydigital.zip").absolute(path + ".js"));<commit_msg>fixes #12<commit_after>var log = require("/api/Log");
var os = Ti.Platform.osname;


// The TiShadow build of the Titanium SDK does not cache CommonJS modules loaded
// from the applicationDataDirectory. This is so that if an update to the app is
// deployed, i.e. a file in the applicationDataDirectory is modified, the changes
// while be loaded. That said loading a CommonJS module every time that it is loaded
// make the deployed bundle run slowly. So we will manage the caching of those
// modules here in the code.
var cache={};

exports.require = function(base,extension) {
  try {
    // In case of double mapping (if required from variable/s)
    if (extension.indexOf(base) !== -1) {
      var regex = new RegExp(base, 'g');
      extension = extension.replace(regex, "/").substring(1);
    }
    // Full Path
    var path = base + extension;
    //Try platform specific path first
    var platform_path =  base + (os === "android" ? "android" : "iphone") + "/" + extension;
    var file = Ti.Filesystem.getFile(platform_path + ".js");
    if (file.exists()) {
      path = platform_path;   
    }
    // Is the CommonJS module in the cache
    if (cache[path]) {
      return cache[path];
    }
    var mod;
    if (os === "android") {
      mod = require(require("com.yydigital.zip").absolute(path + ".js"));
{'fraction_non_alphanumeric': 0.12326120556414219, 'fraction_numerical': 0.0019319938176197836, 'mean_word_length': 2.964777947932619, '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': '803862', 'n_tokens_mistral': 750, 'n_tokens_neox': 741, 'n_words': 292}