ember-data-change-tracker
Version:
Track changes and rollback object attributes and relationships. Ember data 2.5+
20 lines (19 loc) • 451 B
JavaScript
import Transform from "ember-data/transform";
/**
* This transform does not serializes to string,
* with JSON.stringify, but leaves the object as is.
*
* The data often does not need to be stringified
* so it's a valid case
*/
export default Transform.extend({
serialize: function(value) {
return value;
},
deserialize: function(json) {
if (typeof json === "string") {
json = JSON.parse(json);
}
return json;
}
});