<commit_before>if (typeof Handlebars !== 'undefined') {
    //{{getSession 'key'}}
    Handlebars.registerHelper('getSession', function (key) {
      return Session.get(key);
    });

    Handlebars.registerHelper('sessionEquals', function (key, value) {
      return Session.equals(key, value); //When Issue #617 is resolved
    });

    Handlebars.registerHelper('getLength', function (a) {
      return a.length;
    });

    Handlebars.registerHelper('isSelected', function (a, b) {
      return (a == b)?' selected': '';
    });

    Handlebars.registerHelper('isChecked', function (a, b) {
      return (a == b)?' checked': '';
    });

    Handlebars.registerHelper('isConnected', function (a, b) {
      return Meteor.status().connected;
    });

    Handlebars.registerHelper('getUser', function (userId) {
      return Meteor.users.findOne( (typeof(userId) == 'object')?userId[0]:userId);
    });

    Handlebars.registerHelper('cutString', function (str, len) {
      return (str.length > len)?str.substr(0, Math.max(len-3, 0))+'...':str;
    });

    Handlebars.registerHelper('$eq', function (a, b) {
      return (a == b); //Only text, numbers, boolean - not array & objects
    });

    Handlebars.registerHelper('$neq', function (a, b) {
      return (a != b); //Only text, numbers, boolean - not array & objects
    });

    Handlebars.registerHelper('$in', function (a, b, c, d) {
      return ( a == b || a == c || a == d);
    });

    Handlebars.registerHelper('$nin', function (a, b, c, d) {
      return ( a != b || a != c || a != d);
    });

    Handlebars.registerHelper('$exists', function (a) {
      return ( a != undefined);
    });

    Handlebars.registerHelper('$lt', function (a, b) {
      return (a < b);
    });

    Handlebars.registerHelper('$gt', function (a, b) {
      return (a > b);
    });

    Handlebars.registerHelper('$lte', function (a, b) {
      return (a < b);
    });

    Handlebars.registerHelper('$gte', function (a, b) {
      return (a > b);
    });


    Handlebars.registerHelper('$and', function (a, b) {
      return (a && b);
    });

    Handlebars.registerHelper('$or', function (a, b) {
      return (a || b);
    });

    Handlebars.registerHelper('$not', function (a) {
      return (!a);
    });

    // Handlebars.registerHelper('userRole', function ( /* arguments */) {
    //   var role = Session.get('currentRole');
    //   return _.any(arguments, function(value) { return (value == role); });
    // });

    // expects an array: languageText['say.hello.to.me']['en'] = 'Say hello to me:)';
    // ex.:
    // getText('Say.Hello.To.Me') == 'say hello to me:)'; // lowercase
    // getText('SAY.HELLO.TO.ME') == 'SAY HELLO TO ME:)'; // uppercase
    // getText('Say.hello.to.me') == 'Say hello to me:)'; // uppercase first letter, rest lowercase
    // getText('Say.Hello.To.Me') == 'Say Hello To Me:)'; // camelCase

    Session.setDefault('language', 'en');

    window.getText = function(text) {
      // handleCase will mimic text Case making src same case as text
      function handleCase(text, src) {
        // Return lowercase
        if (text == text.toLowerCase())
          return src.toLowerCase();
        // Return uppercase
        if (text == text.toUpperCase())
          return src.toUpperCase();
        // Return uppercase first letter, rest lowercase
        if (text.substr(1) == text.substr(1).toLowerCase() )
          return src.substr(0, 1).toUpperCase()+src.substr(1).toLowerCase();
        // Return CamelCase
        return src.replace(/( [a-z])/g, function($1){
          return $1.toUpperCase();
        });
      }
      var txt = text.toLowerCase();
      return handleCase(text, (languageText && languageText[txt])?( (languageText[txt][Session.get('language')])?languageText[txt][Session.get('language')]: languageText[txt].en):'['+text+']' );
    };

    Handlebars.registerHelper('getText', function (text) {
      return getText(text);
    });
}<commit_msg>Added a helper "call" for invoking js from hb<commit_after>if (typeof Handlebars !== 'undefined') {
    //{{getSession 'key'}}
    Handlebars.registerHelper('getSession', function (key) {
      return Session.get(key);
    });

    Handlebars.registerHelper('sessionEquals', function (key, value) {
      return Session.equals(key, value); //When Issue #617 is resolved
    });

    Handlebars.registerHelper('getLength', function (a) {
      return a.length;
    });

    Handlebars.registerHelper('isSelected', function (a, b) {
      return (a == b)?' selected': '';
    });

    Handlebars.registerHelper('isChecked', function (a, b) {
      return (a == b)?' checked': '';
    });

    Handlebars.registerHelper('isConnected', function (a, b) {
      return Meteor.status().connected;
    });

    Handlebars.registerHelper('getUser', function (userId) {
      return Meteor.users.findOne( (typeof(userId) == 'object')?userId[0]:userId);
    });

    Handlebars.registerHelper('cutString', function (str, len) {
      return (str.length > len)?str.substr(0, Math.max(len-3, 0))+'...':str;
    });

    Handlebars.registerHelper('$eq', function (a, b) {
      return (a == b); //Only text, numbers, boolean - not array & objects
    });

    Handlebars.registerHelper('$neq', function (a, b) {
      return (a != b); //Only text, numbers, boolean - not array & objects
    });

    Handlebars.registerHelper('$in', function (a, b, c, d) {
      return ( a == b || a == c || a == d);
    });

    Handlebars.registerHelper('$nin', function (a, b, c, d) {
      return ( a != b || a != c || a != d);
    });

    Handlebars.registerHelper('$exists', function (a) {
      return ( a != undefined);
    });

    Handlebars.registerHelper('$lt', function (a, b) {
      return (a < b);
    });

    Handlebars.registerHelper('$gt', function (a, b) {
      return (a > b);
    });

    Handlebars.registerHelper('$lte', function (a, b) {
      return (a < b);
    });

    Handlebars.registerHelper('$gte', function (a, b) {
      return (a > b);
    });


    Handlebars.registerHelper('$and', function (a, b) {
      return (a && b);
    });

    Handlebars.registerHelper('$or', function (a, b) {
      return (a || b);
    });

    Handlebars.registerHelper('$not', function (a) {
      return (!a);
    });

    // Handlebars.registerHelper('userRole', function ( /* arguments */) {
    //   var role = Session.get('currentRole');
    //   return _.any(arguments, function(value) { return (value == role); });
    // });

    // expects an array: languageText['say.hello.to.me']['en'] = 'Say hello to me:)';
    // ex.:
    // getText('Say.Hello.To.Me') == 'say hello to me:)'; // lowercase
    // getText('SAY.HELLO.TO.ME') == 'SAY HELLO TO ME:)'; // uppercase
    // getText('Say.hello.to.me') == 'Say hello to me:)'; // uppercase first letter, rest lowercase
    // getText('Say.Hello.To.Me') == 'Say Hello To Me:)'; // camelCase

    Session.setDefault('language', 'en');

    window.getText = function(text) {
      // handleCase will mimic text Case making src same case as text
      function handleCase(text, src) {
        // Return lowercase
        if (text == text.toLowerCase())
          return src.toLowerCase();
        // Return uppercase
        if (text == text.toUpperCase())
          return src.toUpperCase();
        // Return uppercase first letter, rest lowercase
        if (text.substr(1) == text.substr(1).toLowerCase() )
          return src.substr(0, 1).toUpperCase()+src.substr(1).toLowerCase();
        // Return CamelCase
        return src.replace(/( [a-z])/g, function($1){
          return $1.toUpperCase();
        });
      }
      var txt = text.toLowerCase();
      return handleCase(text, (languageText && languageText[txt])?( (languageText[txt][Session.get('language')])?languageText[txt][Session.get('language')]: languageText[txt].en):'['+text+']' );
    };

    Handlebars.registerHelper('getText', function (text) {
      return getText(text);
    });
    
    // Returns a function from string eg.: getNode('console.log')('Write this to log...');
    var getNode = function(string) {
      var splitString = string.split('.');
      var nodeThis = window;

      // Divein nodeThiss
      if (splitString.length)
        for (var i = 0; i < splitString.length-1; i++)
          if (nodeThis)
            nodeThis = nodeThis[splitString[i]];

      // Get the last object    
      var func = (nodeThis)?nodeThis[splitString[splitString.length-1]]:undefined;
      
      if (typeof(func) === "function")
        return function( /* arguments */){
          return func.apply(nodeThis, arguments);
        };

      return function() { return func; };
    } // EO getNode
    
    Handlebars.registerHelper('call', function (command) {
      var args = [];
      for (var i = 1; i < arguments.length-1; i++)
        args[i-1] = arguments[i];
      return getNode(command).apply(window, args);
    });
}
{'fraction_non_alphanumeric': 0.18282703732765385, 'fraction_numerical': 0.003811231924672122, 'mean_word_length': 2.6806930693069306, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4185824', 'n_tokens_mistral': 2812, 'n_tokens_neox': 2744, 'n_words': 657}