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

23 lines
564 B
JavaScript
Raw Normal View History

/**
2026-01-28 17:09:06 -08:00
* Copyright IBM Corp. 2021, 2026
* 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();
}
}