debian-mirror-gitlab/app/assets/javascripts/registry/shared/utils.js

20 lines
415 B
JavaScript
Raw Normal View History

2020-03-09 13:42:32 +05:30
export const findDefaultOption = options => {
const item = options.find(o => o.default);
return item ? item.key : null;
};
export const mapComputedToEvent = (list, root) => {
const result = {};
list.forEach(e => {
result[e] = {
get() {
return this[root][e];
},
set(value) {
this.$emit('input', { ...this[root], [e]: value });
},
};
});
return result;
};