Skip to content

Commit

Permalink
Merge 54be022 into 7be5f8c
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosommi committed Jul 23, 2015
2 parents 7be5f8c + 54be022 commit cd18171
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 1,408 deletions.
6 changes: 1 addition & 5 deletions es5/lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,11 +780,7 @@ var Model = (function () {
}, {
key: "toJSON",
value: function toJSON() {
if (Model.jsonFormatter && typeof Model.jsonFormatter === "function") {
return Model.jsonFormatter(this);
} else {
return this.attributes;
}
return this.attributes;
}
}, {
key: setAttributes,
Expand Down
8 changes: 0 additions & 8 deletions es5/spec/model.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2249,14 +2249,6 @@ describe("Model(attributes, options)", function () {
it("should return a plain unformatted model", function () {
user.toJSON().should.eql(userAttributes);
});

it("should return a formatted model if a formatter is set on Model.jsonFormatter", function () {
var newUserAttributes = { someCustomAttribute: "someCustomAttributeValue" };
_libModelJs2["default"].jsonFormatter = function () {
return newUserAttributes;
};
user.toJSON().should.eql(newUserAttributes);
});
});
});
});
6 changes: 1 addition & 5 deletions es6/lib/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,11 +729,7 @@ export default class Model {
initialize() {}

toJSON() {
if(Model.jsonFormatter && typeof Model.jsonFormatter === "function") {
return Model.jsonFormatter(this);
} else {
return this.attributes;
}
return this.attributes;
}

/**
Expand Down
8 changes: 0 additions & 8 deletions es6/spec/model.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2092,14 +2092,6 @@ describe("Model(attributes, options)", () => {
it("should return a plain unformatted model", () => {
user.toJSON().should.eql(userAttributes);
});

it("should return a formatted model if a formatter is set on Model.jsonFormatter", () => {
let newUserAttributes = {someCustomAttribute: "someCustomAttributeValue"};
Model.jsonFormatter = () => {
return newUserAttributes;
};
user.toJSON().should.eql(newUserAttributes);
});
});
});
});
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
module.exports = require("./es5/lib/model.js");
module.exports.Collection = require("./es5/lib/collection.js");
module.exports.isPresent = require("./es5/lib/validation/isPresent.js");
Loading

0 comments on commit cd18171

Please sign in to comment.