<commit_before>/* ********************************************************************** *
 * ****************************** Node Modules
 * ********************************************************************** */

let async = require('async'),
  _ = require('lodash'),
  uuid = require('uuid');


/* ********************************************************************** *
 * ****************************** Exported Class
 * ********************************************************************** */

module.exports = function(Riposte) {

  class Reply {
    /**
     * Called when a new instance is created using the new keyword.
     * @param {object|undefined} options is object with Reply related properties.
     * @return {object} the reply instance is returned.
     */
    constructor(options) {
      this.fromObject(options);
      return this;
    }

    /**
     * Apply the Reply related properties from an object to this Reply
     * instance.  Where properties are invalid or undefined the default
     * values will be used.
     * @param {object|undefined} obj is object with Reply related properties. 
     * @return {object} the updated reply instance is returned.
     */
    fromObject(obj = {}) {
      this.data = obj.data || this.data;
      this.errors = obj.errors || [];
      this.id = obj.id || uuid.v4();
      this.res = obj.res || this.res;
      this.riposte = obj.riposte || this.riposte;
      return this;
    }<commit_msg>Fixed bug with removing data on fromObject<commit_after>/* ********************************************************************** *
 * ****************************** Node Modules
 * ********************************************************************** */

let async = require('async'),
  _ = require('lodash'),
  uuid = require('uuid');


/* ********************************************************************** *
 * ****************************** Exported Class
 * ********************************************************************** */

module.exports = function(Riposte) {

  class Reply {
    /**
     * Called when a new instance is created using the new keyword.
     * @param {object|undefined} options is object with Reply related properties.
     * @return {object} the reply instance is returned.
     */
    constructor(options) {
      this.fromObject(options);
      return this;
    }

    /**
     * Apply the Reply related properties from an object to this Reply
     * instance.  Where properties are invalid or undefined the default
     * values will be used.
     * @param {object|undefined} obj is object with Reply related properties. 
     * @return {object} the updated reply instance is returned.
     */
    fromObject(obj = {}) {
      this.data = obj.data || undefined;
      this.errors = obj.errors || [];
      this.id = obj.id || uuid.v4();
      this.res = obj.res || this.res;
      this.riposte = obj.riposte || this.riposte;
      return this;
    }
{'fraction_non_alphanumeric': 0.321804001356392, 'fraction_numerical': 0.0006781959986436081, 'mean_word_length': 3.4969512195121952, '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': '2429419', 'n_tokens_mistral': 726, 'n_tokens_neox': 678, 'n_words': 214}