debian-mirror-gitlab/spec/frontend/admin/signup_restrictions/utils.js
2021-04-29 21:17:54 +05:30

19 lines
439 B
JavaScript

export const setDataAttributes = (data, element) => {
Object.keys(data).forEach((key) => {
const value = data[key];
// attribute should be:
// - valueless if value is 'true'
// - absent if value is 'false'
switch (value) {
case false:
break;
case true:
element.dataset[`${key}`] = '';
break;
default:
element.dataset[`${key}`] = value;
break;
}
});
};