validate.js 384 B

1234567891011121314151617
  1. "use strict";
  2. /**
  3. *
  4. * Validates an input to check if an input is provided
  5. *
  6. * @param {String} value - The input string to validate
  7. * @returns {String | Boolean } Returns truthy if its long enough
  8. * Or a string if the user hasn't written anything
  9. */
  10. module.exports = value => {
  11. const pass = value.length;
  12. if (pass) {
  13. return true;
  14. }
  15. return "Please specify an answer!";
  16. };