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

24 lines
429 B
JavaScript
Raw Normal View History

import { isArray, A } from '@ember/array';
2018-04-03 14:16:57 +00:00
import DS from 'ember-data';
/*
This should go inside a globally available place for all apps
DS.attr('array')
*/
export default DS.Transform.extend({
deserialize(value) {
if (isArray(value)) {
return A(value);
2018-04-03 14:16:57 +00:00
} else {
return A();
2018-04-03 14:16:57 +00:00
}
},
serialize(value) {
if (isArray(value)) {
return A(value);
2018-04-03 14:16:57 +00:00
} else {
return A();
2018-04-03 14:16:57 +00:00
}
},
});