packages/uswds-core/src/js/utils/toggle-field-mask.js
/**
* Flips given INPUT elements between masked (hiding the field value) and unmasked
* @param {Array.HTMLElement} fields - An array of INPUT elements
* @param {Boolean} mask - Whether the mask should be applied, hiding the field value
*/
module.exports = (field, mask) => {
field.setAttribute("autocapitalize", "off");
field.setAttribute("autocorrect", "off");
field.setAttribute("type", mask ? "password" : "text");
};