Files
threshold-ui/addons/api/addon/transforms/account-value-map-array.js
T

23 lines
563 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
2025-04-03 09:32:44 -07:00
export default class AccountValueMapArrayTransform {
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],
}));
}
serialize(deserialized) {
const accountValues = deserialized || [];
2024-06-03 13:38:42 -07:00
return accountValues.map(({ key, value }) => `${key}=${value}`);
}
2025-04-03 09:32:44 -07:00
static create() {
return new this();
}
}