<commit_before>/* SQB
 ------------------------
 (c) 2017-present Panates
 SQB may be freely distributed under the MIT license.
 For details and documentation:
 https://panates.github.io/sqb/
 */
'use strict';

/**
 * Module dependencies.
 * @private
 */
const ArgumentError = require('errorex').ArgumentError;
const Operator = require('../Operator');
const Serializable = require('../../Serializable');
const isPlainObject = require('putil-isplainobject');

/**
 *
 * @class
 * @abstract
 */
class LogicalOperator extends Operator {

  /**
   * @param {...Operator} operator
   * @constructor
   * @public
   */
  constructor(...operator) {
    super();
    this._items = [];
    this.operatorType = null;
    this.add(...operator);
  }

  /**
   * Adds operator(s) to item list
   *
   * @param {...Operator} operator
   * @public
   */
  add(...operator) {
    for (const arg of arguments) {
      if (!arg) continue;
      if (isPlainObject(arg)) {
        this.add(...this._wrapObject(arg));
        continue;
      }
      if (!(arg.isOperator || arg.isRaw))
        throw new ArgumentError('Operator or Raw type required');
      this._items.push(arg);
    }
  }<commit_msg>[*] Improvement<commit_after>/* SQB
 ------------------------
 (c) 2017-present Panates
 SQB may be freely distributed under the MIT license.
 For details and documentation:
 https://panates.github.io/sqb/
 */
'use strict';

/**
 * Module dependencies.
 * @private
 */
const ArgumentError = require('errorex').ArgumentError;
const Operator = require('../Operator');
const Serializable = require('../../Serializable');
const isPlainObject = require('putil-isplainobject');

/**
 *
 * @class
 * @abstract
 */
class LogicalOperator extends Operator {

  /**
   * @param {...Operator} operator
   * @constructor
   * @public
   */
  constructor(...operator) {
    super();
    this._items = [];
    this.add(...operator);
  }

  /**
   * Returns operator type
   * @public
   * @return {string}
   */
  get operatorType() {
    return '';
  }

  /**
   * Adds operator(s) to item list
   *
   * @param {...Operator} operator
   * @public
   */
  add(...operator) {
    for (const arg of arguments) {
      if (!arg) continue;
      if (isPlainObject(arg)) {
        this.add(...this._wrapObject(arg));
        continue;
      }
      if (!(arg.isOperator || arg.isRaw))
        throw new ArgumentError('Operator or Raw type required');
      this._items.push(arg);
    }
  }
{'fraction_non_alphanumeric': 0.1799265605875153, 'fraction_numerical': 0.0032639738882088943, 'mean_word_length': 2.434173669467787, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1357556', 'n_tokens_mistral': 760, 'n_tokens_neox': 737, 'n_words': 180}