packages/rebound-data/lib/model.js
function() {
    if (this._isSerializing){ return this.id || this.cid; }
    this._isSerializing = true;
    var json = _.clone(this.attributes);
    _.each(json, function(value, name) {
        if( _.isNull(value) || _.isUndefined(value) ){ return void 0; }
        _.isFunction(value.toJSON) && (json[name] = value.toJSON());
    });
    this._isSerializing = false;
    return json;
  }
function() {
    if (this._isSerializing){ return this.id || this.cid; }
    this._isSerializing = true;
    var json = _.clone(this.attributes);
    _.each(json, function(value, name) {
        if( _.isNull(value) || _.isUndefined(value) ){ return void 0; }
        _.isFunction(value.toJSON) && (json[name] = value.toJSON());
    });
    this._isSerializing = false;
    return json;
  }
function ( ) { if ( this . _isSerializing ) { return this . id || this . cid ; } this . _isSerializing = true ; var json = _ . clone ( this . attributes ) ; _ . each ( json , function ( value , name ) { if ( _ . isNull ( value ) || _ . isUndefined ( value ) ) { return void 0 ; } _ . isFunction ( value . toJSON ) && ( json [ name ] = value . toJSON ( ) ) ; } ) ; this . _isSerializing = false ; return json ; }
Recursive `toJSON` function traverses the data tree returning a JSON object. If there are any cyclic dependancies the object's `cid` is used instead of looping infinitely.
Recursive toJSON function traverses the data tree returning a JSON object . If there are any cyclic dependancies the object s cid is used instead of looping infinitely .