<commit_before>var errors = require('./errors');
var operation_names = require('./operation_names');
operation_names = Object.keys(operation_names).map(function (k) {
  return operation_names[k];
});

module.exports = function (name, code, seed, identity, identityCode) {
  if (!name || -1 === operation_names.indexOf(name)) {
    throw new errors.InvalidArgumentsError(errors.messages.INVALID_OPERATION);
  }
  if (!code) {
    throw new errors.InvalidArgumentsError(errors.messages.INVALID_CODE);
  }
  if (name === 'reduce' && undefined === identityCode) {
    throw new errors.InvalidArgumentsError(errors.messages.INVALID_IDENTITY_CODE);
  }
  if (name === 'reduce' && undefined === seed) {
    throw new errors.InvalidArgumentsError(errors.messages.MISSING_SEED);
  }
  if (name === 'reduce' && undefined === identity) {
    throw new errors.InvalidArgumentsError(errors.messages.MISSING_IDENTITY);
  }

  return {
    name: name,
    code: code,
    seed: seed,
    identity: identity,
    identityCode: identityCode
  };
};<commit_msg>Fix comparison for undefined<commit_after>var errors = require('./errors');
var operation_names = require('./operation_names');
operation_names = Object.keys(operation_names).map(function (k) {
  return operation_names[k];
});

module.exports = function (name, code, seed, identity, identityCode) {
  if (!name || -1 === operation_names.indexOf(name)) {
    throw new errors.InvalidArgumentsError(errors.messages.INVALID_OPERATION);
  }
  if (!code) {
    throw new errors.InvalidArgumentsError(errors.messages.INVALID_CODE);
  }
  if (name === 'reduce' && typeof identityCode === 'undefined') {
    throw new errors.InvalidArgumentsError(errors.messages.INVALID_IDENTITY_CODE);
  }
  if (name === 'reduce' && typeof seed === 'undefined') {
    throw new errors.InvalidArgumentsError(errors.messages.MISSING_SEED);
  }
  if (name === 'reduce' && typeof identity === 'undefined') {
    throw new errors.InvalidArgumentsError(errors.messages.MISSING_IDENTITY);
  }

  return {
    name: name,
    code: code,
    seed: seed,
    identity: identity,
    identityCode: identityCode
  };
};
{'fraction_non_alphanumeric': 0.14191729323308272, 'fraction_numerical': 0.0009398496240601503, 'mean_word_length': 4.587926509186352, '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': '4594096', 'n_tokens_mistral': 620, 'n_tokens_neox': 613, 'n_words': 136}