<commit_before>
var json5 = require("json5");
var loaderUtils = require("loader-utils");
var pick = require("lodash.pick");

module.exports = function(content) {
  var query = loaderUtils.parseQuery(this.query);
  var data = json5.parse(content);
  if(Array.isArray(data)) {
    data = data.map(function(item) {
      return pick(item, "name");
    });
  } else {
    data = pick(data, "name");
  }
  return JSON.stringify(data);
};
<commit_msg>use query param<commit_after>
var json5 = require("json5");
var loaderUtils = require("loader-utils");
var pick = require("lodash.pick");

module.exports = function(content) {
  this.cacheable();
  var query = loaderUtils.parseQuery(this.query);
  var data = json5.parse(content);
  if(Array.isArray(data)) {
    data = data.map(function(item) {
      return pick(item, Object.keys(query));
    });
  } else {
    data = pick(data, Object.keys(query));
  }
  return JSON.stringify(data);
};

{'fraction_non_alphanumeric': 0.16880341880341881, 'fraction_numerical': 0.00641025641025641, 'mean_word_length': 4.176795580110498, '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': '1473382', 'n_tokens_mistral': 310, 'n_tokens_neox': 309, 'n_words': 63}