<commit_before>#!/usr/bin/env node
var _ = require('lodash');
var argv = require('minimist')(process.argv.slice(2));

var lut = require(argv.l);

require('readline').createInterface(
  {
    input: process.stdin,
    terminal: false
  }
).on('line', function(line) { // one JSON object per line
  var mongo = JSON.parse(line);
  if (lut.hasOwnProperty(mongo._id)) {
    _.merge(mongo,lut[mongo._id]);
    console.log(JSON.stringify(mongo));
  }
});<commit_msg>don't replace arrays while merging<commit_after>#!/usr/bin/env node
var _ = require('lodash');
var argv = require('minimist')(process.argv.slice(2));

var lut = require(argv.l);

function customizer(objValue, srcValue) {
  if (_.isArray(objValue)) {
    return objValue.concat(srcValue);
  }
}

require('readline').createInterface(
  {
    input: process.stdin,
    terminal: false
  }
).on('line', function(line) { // one JSON object per line
  var mongo = JSON.parse(line);
  if (lut.hasOwnProperty(mongo._id)) {
    _.mergeWith(mongo,lut[mongo._id],customizer);
    console.log(JSON.stringify(mongo));
  }
});
{'fraction_non_alphanumeric': 0.17537313432835822, 'fraction_numerical': 0.0018656716417910447, 'mean_word_length': 4.391959798994975, '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': '6415367', 'n_tokens_mistral': 384, 'n_tokens_neox': 378, 'n_words': 69}