open-vault/ui/app/transforms/array.js
Hamid Ghaf 27bb03bbc0
adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00

29 lines
533 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
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();
}
},
});