<commit_before>'use strict';

const ReactMultiChild = require('react/lib/ReactMultiChild');

const PDFRendererComponent = function(element) {
  this.node = null;
  this._mountImage = null;
  this._renderedChildren = null;
  this._currentElement = element;
};

const PDFRendererComponentMixin = {
  getPublicInstance() {
    return this.node;
  },

  mountComponent(
    transaction,
    nativeParent,
    nativeContainerInfo,
    context
  ) {
    this.node = this._currentElement;

    if (this.node.type != 'document') {
      switch (this.node.type) {
        case 'page':
          // Because the document already starts with a page
          // we don't call addPage the first time
          if (context.firstPageSkipped)
            context.doc.addPage();

          context.firstPageSkipped = true;
          break;
        case 'rect':
          var {x, y, width, height, cornerRadius} = this.node.props;

          if (cornerRadius) {
            context.doc.roundedRect(x, x, width, height, cornerRadius).stroke();
          } else {
            context.doc.rect(x, x, width, height).stroke();
          }
        case 'circle':
          var {x, y, radius} = this.node.props;

          context.doc.circle(x, x, radius).stroke();
          break;
        default:
          context.doc[this.node.type](
            this.node.props.children,
            this.node.props
          );
      }
    }

    // Naive way of not mounting TextComponent
    if (typeof this.node.props.children != 'string') {
      this.mountChildren(this.node.props.children, transaction, context);
    }

    return this.node;
  },<commit_msg>Minor refactor<commit_after>'use strict';

const ReactMultiChild = require('react/lib/ReactMultiChild');

const PDFRendererComponent = function(element) {
  this.node = null;
  this._mountImage = null;
  this._renderedChildren = null;
  this._currentElement = element;
};

const PDFRendererComponentMixin = {
  getPublicInstance() {
    return this.node;
  },

  mountComponent(
    transaction,
    nativeParent,
    nativeContainerInfo,
    context
  ) {
    let node = this.node = this._currentElement;

    if (node.type != 'document') {
      switch (node.type) {
        case 'page':
          // Because the document already starts with a page
          // we don't call addPage the first time
          if (context.firstPageSkipped)
            context.doc.addPage();

          context.firstPageSkipped = true;
          break;
        case 'rect':
          var {x, y, width, height, cornerRadius} = node.props;

          if (cornerRadius) {
            context.doc.roundedRect(x, x, width, height, cornerRadius).stroke();
          } else {
            context.doc.rect(x, x, width, height).stroke();
          }
        case 'circle':
          var {x, y, radius} = node.props;

          context.doc.circle(x, x, radius).stroke();
          break;
        default:
          context.doc[node.type](
            node.props.children,
            node.props
          );
      }
    }

    // Naive way of not mounting TextComponent
    if (typeof node.props.children != 'string') {
      this.mountChildren(node.props.children, transaction, context);
    }

    return this.node;
  },
{'fraction_non_alphanumeric': 0.11658914728682171, 'fraction_numerical': 0.0, 'mean_word_length': 2.1199226305609282, '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': '2592428', 'n_tokens_mistral': 933, 'n_tokens_neox': 918, 'n_words': 217}