import { computed } from 'vue';

const useComputedFields = (queryParams, fields) => {
  return computed({
    get: () => {
      return fields.map((field) => queryParams.value[field]);
    },
    set: (val) => {
      val = val ?? [];
      if (!Array.isArray(val)) {
        console.warn("Value array length does not match fields array length");
        return;
      }
      fields.forEach((field, index) => {
        queryParams.value[field] = val[index];
      });
    }
  });
};

export { useComputedFields };
//# sourceMappingURL=index.mjs.map
