Files
threshold-ui/addons/api/addon/transforms/host-source-id-array.js
T

23 lines
517 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 HostSourceIdArrayTransform {
deserialize(serialized) {
const stringValues = serialized || [];
return stringValues.map(({ id: host_source_id, ...obj }) => ({
host_source_id,
...obj,
}));
}
serialize(deserialized) {
const strings = deserialized || [];
return strings.map(({ host_source_id: id, ...obj }) => ({ id, ...obj }));
}
2025-04-03 09:32:44 -07:00
static create() {
return new this();
}
}