<commit_before>/** @namespace sputils.lib */

/**
* "taps" a function to produce a side effect
* but wrap it in an identity fn.
*
* @function sputils.lib.tap
**/
var tap = function (fn) {
  return function (value) {
    fn();
    return value;
  };
};


/**
* Get a value deeply from an object without crashing on nulls.
*
* This function is dynamic, so can be bound or just assigned to an
* object.
*
* Can be used to "index" arrays.
*
* @function sputils.lib.getval
* @param {string} subscript - the subscript string, i.e. 'a.b.c.prop'
* @param {Optional<object>} root - the root object. Defaults to this.
* @returns {string} the value of the prop, if exists else undefined
* @example
* var obj = {a:{b:{c:{}}}}
* var c = sputils.lib.getval('a.b.c', obj);
* c === obj.a.b.c;
* var none = sputils.lib.getval('a.b.1.notHere', obj);<commit_msg>pass parameter to the function supplied to `tap`<commit_after>/** @namespace sputils.lib */

/**
* "taps" a function to produce a side effect
* but wrap it in an identity fn.
*
* @function sputils.lib.tap
**/
var tap = function (fn) {
  return function (value) {
    fn(value);
    return value;
  };
};


/**
* Get a value deeply from an object without crashing on nulls.
*
* This function is dynamic, so can be bound or just assigned to an
* object.
*
* Can be used to "index" arrays.
*
* @function sputils.lib.getval
* @param {string} subscript - the subscript string, i.e. 'a.b.c.prop'
* @param {Optional<object>} root - the root object. Defaults to this.
* @returns {string} the value of the prop, if exists else undefined
* @example
* var obj = {a:{b:{c:{}}}}
* var c = sputils.lib.getval('a.b.c', obj);
* c === obj.a.b.c;
* var none = sputils.lib.getval('a.b.1.notHere', obj);
{'fraction_non_alphanumeric': 0.15874855156431056, 'fraction_numerical': 0.0011587485515643105, 'mean_word_length': 3.4740932642487046, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5067326', 'n_tokens_mistral': 607, 'n_tokens_neox': 599, 'n_words': 216}