<commit_before>"use strict";

const util = require("gulp-util");
const through = require("through2");
const moment = require("moment");

module.exports = function(options) {
  options = options || {};

  function updateDate(file, options) {
    const now   = moment().format("YYYY/MM/DD"),
          regex = /Last updated?: ?(\d{4}\/\d{2}\/\d{2})/i,
          prev  = regex.exec(file)[1];

    if (options.log) {
      util.log(
        `${util.colors.cyan("[gulp-update-humanstxt-date]")} ` +
        `Found the previous date to be: ${util.colors.red(prev)}. ` +
        `Replacing with ${util.colors.green(now)}.`
      );
    }
<commit_msg>Add comments to source code<commit_after>"use strict";

const util = require("gulp-util");
const through = require("through2");
const moment = require("moment");

module.exports = function(options) {
  // Avoid "cannot get property of `undefined`" type errors
  options = options || {};

  function updateDate(file, options) {
    const now   = moment().format("YYYY/MM/DD"),
          // Regular Expression breakdown:
          // 1) Match "Last updated: " case in-sensitive
          //   - The 'd' is optional
          //   - The space after the colon is optional
          // 2) Exactly 4 digits followed by a slash
          // 3) Exactly 2 digits followed by a slash
          // 4) Exactly 2 digits
          //
          //            [1]          [2]    [3]    [4]
          regex = /Last updated?: ?(\d{4}\/\d{2}\/\d{2})/i,
          prev  = regex.exec(file)[1];

    if (options.log) {
      util.log(
        `${util.colors.cyan("[gulp-update-humanstxt-date]")} ` +
        `Found the previous date to be: ${util.colors.red(prev)}. ` +
        `Replacing with ${util.colors.green(now)}.`
      );
    }

{'fraction_non_alphanumeric': 0.17111995451961343, 'fraction_numerical': 0.011938601478112564, 'mean_word_length': 2.2058287795992713, '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': '2286009', 'n_tokens_mistral': 566, 'n_tokens_neox': 549, 'n_words': 139}