Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Transform from '@ember-data/serializer/transform';
import { typeOf } from '@ember/utils';
/*
DS.attr('object')
*/
export default Transform.extend({
deserialize: function(value) {
if (typeOf(value) !== 'object') {
return {};
} else {
return value;
}
},
serialize: function(value) {
if (typeOf(value) !== 'object') {
return {};
} else {
return value;
}
},
});
import Transform from '@ember-data/serializer/transform';
import { isArray, A } from '@ember/array';
/*
This should go inside a globally available place for all apps
DS.attr('array')
*/
export default Transform.extend({
deserialize(value) {
if (isArray(value)) {
return A(value);
} else {
return A();
}
},
serialize(value) {
if (isArray(value)) {
return A(value);
} else {
return A();
}
},
});