• File: readBooleans.js
  • Full Path: /var/www/nodejs/callDir/node_modules/formidable/src/helpers/readBooleans.js
  • Date Modified: 06/03/2024 5:11 PM
  • File size: 310 bytes
  • MIME-type: text/plain
  • Charset: utf-8
const readBooleans = (fields, listOfBooleans) => {
  // html forms do not send off at all
  const fieldsWithBooleans = { ...fields };
  listOfBooleans.forEach((key) => {
    fieldsWithBooleans[key] = fields[key] === `on` || fields[key] === true;
  });
  return fieldsWithBooleans;
};

export { readBooleans };