<commit_before>
"use strict"

var _ = require('lodash');
var debug = require('debug')('cp-zen-platform:handlers');

module.exports = function(server, role) {

  function doAct (request, reply, cmd, param, user) {
    var zenHostname = request && request.headers.host || '127.0.0.1:8000';
    var msg = {cmd: cmd, role: role, zenHostname: zenHostname, locality: server.methods.locality(request)};
    debug ('handlers.doAct', request.url.path);
    if (request.payload) {
      msg = _.extend(msg, request.payload);
    }
    if (request.query) {
      msg = _.extend(msg, request.query);
    }

    if (param) {
      var paramsMsg = {};
      var params = _.isArray(param) ? param : [param];
      _.each(params, function (p) {
        if (request.params[p]) paramsMsg[p] = request.params[p];
      });
      msg = _.extend(msg, paramsMsg);
    }<commit_msg>added missing dependency<commit_after>
"use strict"

var _ = require('lodash');
_.mixin(require("lodash-deep"));
var debug = require('debug')('cp-zen-platform:handlers');

module.exports = function(server, role) {

  function doAct (request, reply, cmd, param, user) {
    var zenHostname = request && request.headers.host || '127.0.0.1:8000';
    var msg = {cmd: cmd, role: role, zenHostname: zenHostname, locality: server.methods.locality(request)};
    debug ('handlers.doAct', request.url.path);
    if (request.payload) {
      msg = _.extend(msg, request.payload);
    }
    if (request.query) {
      msg = _.extend(msg, request.query);
    }

    if (param) {
      var paramsMsg = {};
      var params = _.isArray(param) ? param : [param];
      _.each(params, function (p) {
        if (request.params[p]) paramsMsg[p] = request.params[p];
      });
      msg = _.extend(msg, paramsMsg);
    }
{'fraction_non_alphanumeric': 0.1674233825198638, 'fraction_numerical': 0.011350737797956867, 'mean_word_length': 3.197619047619048, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '2797005', 'n_tokens_mistral': 598, 'n_tokens_neox': 579, 'n_words': 133}