debian-mirror-gitlab/spec/frontend/admin/signup_restrictions/utils.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
439 B
JavaScript
Raw Normal View History

2021-04-29 21:17:54 +05:30
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;
}
});
};