<commit_before>/*
==================================================================================================
  Core - JavaScript Foundation
  Copyright 2012-2013 <NAME>
==================================================================================================
*/

(function() 
{
  var globalId = 0;

  /**
   * Models are the heart of any JavaScript application, 
   * containing the interactive data as well as a large 
   * part of the logic surrounding it: conversions, validations, 
   * computed properties, and access control. You extend `core.mvc.model.Model`
   * with your domain-specific methods, and `Model` provides a basic 
   * set of functionality for managing changes.
   */
  core.Class("core.mvc.model.Model", 
  {
    include: [core.property.MGeneric, core.event.MEventTarget],
    implement : [core.mvc.model.IModel],

    /**
     * Initial data structure is imported from @values {Map}.
     */
    construct: function(values) 
    {
      if (jasy.Env.isSet("debug")) 
      {
        if (values != null) {
          core.Assert.isType(values, "Map", "Invalid values to import!");
        }
      }

      // Automatically created client-side ID
      this.__clientId = "model:" + (globalId++);

      // Import given values
      if (values != null) {
        this.set(values);
      }
    },

    events :
    {
      /** Fired whenever the model is changed in a way that is interesting for listeners */
      "change" : core.event.Simple
    },

    members: 
    {
      error : function(message) {
        console.error("Model Error: " + message);
      },

      __id : null,

      // Interface implementation
      getId : function() {
        return this.__id;
      },

      // Interface implementation
      setId : function(id) {
        return this.__id = id;
      },

      __clientId : null,

      // Interface implementation
      getClientId : function() {
        return this.__clientId;
      },

      // Interface implementation
      toJSON : function() {
        return this.get(Object.keys(core.Class.getProperties(this.constructor)));
      },

      // Interface implementation
      sync : function() {
        return core.mvc.Sync.sync(this);
      }
    }
  });
})();<commit_msg>Improved toJSON to call toJSON on property values<commit_after>/*
==================================================================================================
  Core - JavaScript Foundation
  Copyright 2012-2013 <NAME>
==================================================================================================
*/

(function() 
{
  var globalId = 0;

  /**
   * Models are the heart of any JavaScript application, 
   * containing the interactive data as well as a large 
   * part of the logic surrounding it: conversions, validations, 
   * computed properties, and access control. You extend `core.mvc.model.Model`
   * with your domain-specific methods, and `Model` provides a basic 
   * set of functionality for managing changes.
   */
  core.Class("core.mvc.model.Model", 
  {
    include: [core.property.MGeneric, core.event.MEventTarget],
    implement : [core.mvc.model.IModel],

    /**
     * Initial data structure is imported from @values {Map}.
     */
    construct: function(values) 
    {
      if (jasy.Env.isSet("debug")) 
      {
        if (values != null) {
          core.Assert.isType(values, "Map", "Invalid values to import!");
        }
      }

      // Automatically created client-side ID
      this.__clientId = "model:" + (globalId++);

      // Import given values
      if (values != null) {
        this.set(values);
      }
    },

    events :
    {
      /** Fired whenever the model is changed in a way that is interesting for listeners */
      "change" : core.event.Simple
    },

    members: 
    {
      error : function(message) {
        console.error("Model Error: " + message);
      },

      __id : null,

      // Interface implementation
      getId : function() {
        return this.__id;
      },

      // Interface implementation
      setId : function(id) {
        return this.__id = id;
      },

      __clientId : null,

      // Interface implementation
      getClientId : function() {
        return this.__clientId;
      },

      // Interface implementation
      toJSON : function() 
      {
        return this.get(Object.keys(core.Class.getProperties(this.constructor))).map(function(value) {
          value.toJSON ? value.toJSON() : value
        });
      },

      // Interface implementation
      sync : function() {
        return core.mvc.Sync.sync(this);
      }
    }
  });
})();
{'fraction_non_alphanumeric': 0.1939878892733564, 'fraction_numerical': 0.0038927335640138406, 'mean_word_length': 2.3783783783783785, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1440343', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1180, 'n_words': 326}