open-vault/ui/app/transforms/object.js

22 lines
397 B
JavaScript
Raw Normal View History

2018-04-03 14:16:57 +00:00
import DS from 'ember-data';
import { typeOf } from '@ember/utils';
2018-04-03 14:16:57 +00:00
/*
DS.attr('object')
*/
export default DS.Transform.extend({
deserialize: function(value) {
if (typeOf(value) !== 'object') {
2018-04-03 14:16:57 +00:00
return {};
} else {
return value;
}
},
serialize: function(value) {
if (typeOf(value) !== 'object') {
2018-04-03 14:16:57 +00:00
return {};
} else {
return value;
}
},
});