<commit_before>// -----------------------------------------------------------------------------
// Get rid of `copyProperties`
function rmCopyProperties(file, api, options) {
  const j = api.jscodeshift;

  const {getRequireCall, removeRequire} = require('./utils/require')(j);

  const printOptions = options.printOptions || {quote: 'single'};
  const root = j(file.source);

  const checkArguments = path =>
    path.value.arguments.slice(1).every(argument =>
      argument.type == 'ObjectExpression' ||
      (
        options.arbiterMixin &&
        argument.type == 'Identifier' &&
        argument.name == 'ArbiterMixin'
      )
    );

  const availableFilters = {
    onlyPrototypeAssignments(path) {
      var node = path.value.arguments[0];
      return (
        node.type == 'MemberExpression' &&
        node.object.type == 'Identifier' &&
        node.property.type == 'Identifier' &&
        node.property.name == 'prototype'
      );
    },
    onlyThisExpressions(path) {
      return path.value.arguments[0].type == 'ThisExpression';
    },
    onlyNewExpressions(path) {
      return path.value.arguments[0].type == 'NewExpression';
    },
    onlyCapitalizedIdentifiers(path) {
      var node = path.value.arguments[0];
      return (
        node.type == 'Identifier' &&
        node.name.charAt(0) == node.name.charAt(0).toUpperCase()
      );
    },
    onlyCallExpressions(path) {<commit_msg>Add option to convert `options || {}` and `config || {}`.<commit_after>// -----------------------------------------------------------------------------
// Get rid of `copyProperties`
function rmCopyProperties(file, api, options) {
  const j = api.jscodeshift;

  const {getRequireCall, removeRequire} = require('./utils/require')(j);

  const printOptions = options.printOptions || {quote: 'single'};
  const root = j(file.source);

  const isOptionsOrConfig = node => {
    if (node.type == 'Identifier' &&
      (
        node.name == 'options' ||
        node.name == 'config'
      )
    ) {
      return true;
    }

    if (node.type == 'LogicalExpression' && node.operator == '||') {
      return (
        isOptionsOrConfig(node.left) &&
        node.right.type == 'ObjectExpression' &&
        !node.right.properties.length
      );
    }

    return false;
  };

  const checkArguments = path =>
    path.value.arguments.slice(1).every(argument =>
      argument.type == 'ObjectExpression' ||
      (
        options.arbiterMixin &&
        argument.type == 'Identifier' &&
        argument.name == 'ArbiterMixin'
      ) ||
      (
        options.optionsOrConfig &&
        isOptionsOrConfig(argument)
      )
    );

  const availableFilters = {
    onlyPrototypeAssignments(path) {
      var node = path.value.arguments[0];
      return (
        node.type == 'MemberExpression' &&
        node.object.type == 'Identifier' &&
        node.property.type == 'Identifier' &&
        node.property.name == 'prototype'
      );
    },
    onlyThisExpressions(path) {
      return path.value.arguments[0].type == 'ThisExpression';
    },
    onlyNewExpressions(path) {
      return path.value.arguments[0].type == 'NewExpression';
    },
    onlyCapitalizedIdentifiers(path) {
      var node = path.value.arguments[0];
      return (
        node.type == 'Identifier' &&
        node.name.charAt(0) == node.name.charAt(0).toUpperCase()
      );
    },
    onlyCallExpressions(path) {
{'fraction_non_alphanumeric': 0.1875, 'fraction_numerical': 0.004107981220657277, 'mean_word_length': 2.183006535947712, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '796016', 'n_tokens_mistral': 979, 'n_tokens_neox': 969, 'n_words': 168}