<commit_before>var operation = module.exports = function(op) {
  // console.log("operation(", op, ")", typeof op);

  switch (typeof op) {
    case "function":
      break;

    case "string":
      op = operation.insert(op);
      break;

    case "object":
      if (op === null) {
        return null;
      } else if (Array.isArray(op)) {

        op = operation.list(op);

      } else {

        var params = op;
        switch (op.type) {

          case "script":
            op = operation.insert.script(op.url);
            apply(op, params, ["url"]);
            break;

          case "style":
            op = operation.insert.style(op.url, op.element);
            apply(op, params, ["element", "url"]);
            break;

          case "html":
            op = operation.insert.html(op.name);
            apply(op, original, ["name"]);
            break;

          case "replace":
            op = operation.replace(op.input, op.output);
            apply(op, original, ["input", "output"]);
            break;

          default:
            op = operation.map(op);
            break;
        }
      }

      break;

    case "undefined":
      return null;
  }
<commit_msg>fix order of apply() arguments<commit_after>var operation = module.exports = function(op) {
  // console.log("operation(", op, ")", typeof op);

  switch (typeof op) {
    case "function":
      break;

    case "string":
      op = operation.insert(op);
      break;

    case "object":
      if (op === null) {
        return null;
      } else if (Array.isArray(op)) {

        op = operation.list(op);

      } else {

        var params = op;
        switch (op.type) {

          case "script":
            op = operation.insert.script(op.url);
            apply(params, op, ["url"]);
            break;

          case "style":
            op = operation.insert.style(op.url, op.element);
            apply(params, op, ["element", "url"]);
            break;

          case "html":
            op = operation.insert.html(op.name);
            apply(params, op, ["name"]);
            break;

          case "replace":
            op = operation.replace(op.input, op.output);
            apply(params, op, ["input", "output"]);
            break;

          default:
            op = operation.map(op);
            break;
        }
      }

      break;

    case "undefined":
      return null;
  }

{'fraction_non_alphanumeric': 0.1457725947521866, 'fraction_numerical': 0.0, 'mean_word_length': 1.5151832460732984, 'pattern_counts': {'":': 16, '<': 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': '1151686', 'n_tokens_mistral': 706, 'n_tokens_neox': 683, 'n_words': 168}