bin/ampersand-jsonapi-model.js
function serialize() {
    var _this2 = this;

    var res = this.getAttributes({
      props: true,
      children: false,
      collections: false
    }, true);
    var id = res.id;
    var relationships = {};

    (0, _lodash4.default)(this._children, function (value, key) {
      relationships[key] = {
        data: {
          id: _this2[key].id,
          type: _this2[key].type
        }
      };
    }, this);

    delete res.id;

    return {
      data: {
        id: id,
        type: this.type,
        attributes: res,
        relationships: relationships
      }
    };
  }
function serialize() {
    var _this2 = this;

    var res = this.getAttributes({
      props: true,
      children: false,
      collections: false
    }, true);
    var id = res.id;
    var relationships = {};

    (0, _lodash4.default)(this._children, function (value, key) {
      relationships[key] = {
        data: {
          id: _this2[key].id,
          type: _this2[key].type
        }
      };
    }, this);

    delete res.id;

    return {
      data: {
        id: id,
        type: this.type,
        attributes: res,
        relationships: relationships
      }
    };
  }
function serialize ( ) { var _this2 = this ; var res = this . getAttributes ( { props : true , children : false , collections : false } , true ) ; var id = res . id ; var relationships = { } ; ( 0 , _lodash4 . default ) ( this . _children , function ( value , key ) { relationships [ key ] = { data : { id : _this2 [ key ] . id , type : _this2 [ key ] . type } } ; } , this ) ; delete res . id ; return { data : { id : id , type : this . type , attributes : res , relationships : relationships } } ; }
Serializes the model into a format which the JSON-API server
expects.
@method serialize
@memberof JSONAPIModel
@instance
@override
@returns {Object} The JSON-API-formatted model.
Serializes the model into a format which the JSON - API server expects .