<commit_before>'use strict'

var gulp = require('gulp')
var normalize = require('./normalize.js')
var missing = require('./missing.js')

/**
 * Register matching 'build' and 'watch' gulp tasks and return their name
 * @param {Array|Object} configs - config object or array of config objects
 * @param {string} key - short name of task
 * @param {Function} builder - callback that takes a config object
 * @returns {Array} - names of registered tasks
 */
module.exports = function(configs, key, builder) {
  configs = normalize(configs, key)
  var taskNames = []

  configs.forEach(function(config, index) {
    var id = key + (configs.length > 1 ? ':' + index : '')
    var buildId = 'build:' + id
    var watchId = 'watch:' + id

    // Register build task
    gulp.task(buildId, function() {
      // notify about paths or patterns that match no files
      config.src.forEach(function(pattern) {
        missing(pattern, id)
      })
      // do the actual building
      builder(config)
    })
    taskNames.push(buildId)

    // Register matching watch task
    if (config.watch) {
      gulp.task(watchId, function() {
        gulp.watch(config.watch, [buildId])
      })
      taskNames.push(watchId)
    }
  })

  return taskNames
}<commit_msg>style(register): use dot instead of colons in task names<commit_after>'use strict'

var gulp = require('gulp')
var normalize = require('./normalize.js')
var missing = require('./missing.js')

/**
 * Register matching 'build' and 'watch' gulp tasks and return their name
 * @param {Array|Object} configs - config object or array of config objects
 * @param {string} key - short name of task
 * @param {Function} builder - callback that takes a config object
 * @returns {Array} - names of registered tasks
 */
module.exports = function(configs, key, builder) {
  configs = normalize(configs, key)
  var taskNames = []

  configs.forEach(function(config, index) {
    var id = key + (configs.length > 1 ? '.' + index : '')
    var buildId = 'build.' + id
    var watchId = 'watch.' + id

    // Register build task
    gulp.task(buildId, function() {
      // notify about paths or patterns that match no files
      config.src.forEach(function(pattern) {
        missing(pattern, id)
      })
      // do the actual building
      builder(config)
    })
    taskNames.push(buildId)

    // Register matching watch task
    if (config.watch) {
      gulp.task(watchId, function() {
        gulp.watch(config.watch, [buildId])
      })
      taskNames.push(watchId)
    }
  })

  return taskNames
}
{'fraction_non_alphanumeric': 0.12603062426383982, 'fraction_numerical': 0.0007852375343541421, 'mean_word_length': 2.932098765432099, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4872176', 'n_tokens_mistral': 761, 'n_tokens_neox': 745, 'n_words': 238}