<commit_before>/**
 * Created by Awesome on 1/30/2016.
 */

// use strict
'use strict';

// require dependencies
var mongorito = require('mongorito');

/**
 * build model
 */
class model extends mongorito.Model {
    /**
     * construct model entity
     *
     * @param props
     */
    constructor(props) {
        // run super
        super(props);

        // bind model methods
        this._isModel   = this._isModel.bind(this);
        this._loadModel = this._loadModel.bind(this);

        // set model location
        this._modelLocation = module.parent.filename.replace(global.appRoot, '');
        this._loads         = {};

        // set attributes before save
        this.before ('save', '_setAttributes');
        this.after  ('save', '_getAttributes');

        // run attributes method
        this._getAttributes();
    }

    /**
     * gets models from attributes
     *
     * @param next
     * @private
     */
    * _getAttributes(next) {
        // loop attributes
        for (var key in this.attributes) {
            var attr = this.attributes[key];

            // check if is object
            if (attr === Object(attr) && attr.model) {
                // load model
                this._loadModel(key, attr);
            } else if (Array.isArray(attr)) {<commit_msg>log for trace in model<commit_after>/**
 * Created by Awesome on 1/30/2016.
 */

// use strict
'use strict';

// require dependencies
var mongorito = require('mongorito');

/**
 * build model
 */
class model extends mongorito.Model {
    /**
     * construct model entity
     *
     * @param props
     */
    constructor(props) {
        // run super
        super(props);

        // bind model methods
        this._isModel   = this._isModel.bind(this);
        this._loadModel = this._loadModel.bind(this);

        // set model location
        this._modelLocation = module.parent.filename.replace(global.appRoot, '');
        this._loads         = {};

        // set attributes before save
        this.before ('save', '_setAttributes');
        this.after  ('save', '_getAttributes');

        // run attributes method
        this._getAttributes();
    }

    /**
     * gets models from attributes
     *
     * @param next
     * @private
     */
    * _getAttributes(next) {
        // loop attributes
        for (var key in this.attributes) {
            // set let attribute
            let attr = this.attributes[key];

            console.log(attr);

            // check if is object
            if (attr === Object(attr) && attr.model) {
                // load model
                this._loadModel(key, attr);
            } else if (Array.isArray(attr)) {
{'fraction_non_alphanumeric': 0.1253731343283582, 'fraction_numerical': 0.0052238805970149255, 'mean_word_length': 1.7135627530364372, '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': '1041925', 'n_tokens_mistral': 744, 'n_tokens_neox': 718, 'n_words': 188}