2023-07-13 09:19:38 -04:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2024-05-31 11:29:24 -07:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-07-13 09:19:38 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import Transform from '@ember-data/serializer/transform';
|
|
|
|
|
|
|
|
|
|
export default class AccountValueMapArrayTransform extends Transform {
|
|
|
|
|
deserialize(serialized) {
|
|
|
|
|
const accountValues = serialized || [];
|
|
|
|
|
return accountValues.map((accountValueString) => ({
|
2024-06-03 13:38:42 -07:00
|
|
|
key: accountValueString.split('=')[0],
|
|
|
|
|
value: accountValueString.split('=')[1],
|
2023-07-13 09:19:38 -04:00
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
serialize(deserialized) {
|
|
|
|
|
const accountValues = deserialized || [];
|
2024-06-03 13:38:42 -07:00
|
|
|
return accountValues.map(({ key, value }) => `${key}=${value}`);
|
2023-07-13 09:19:38 -04:00
|
|
|
}
|
|
|
|
|
}
|