String validation for Google Apps Script projects
Sourabh Choraria has packaged some of the validator.js methods into a Google Apps Script library. Ported validators currently include
isEmail, date validators and more. Sourabh has also posted the backstory behind this library.
Source: GitHub – validatorgs/validator.gs: String validation for Google Apps Script projects.
Member of Google Developers Experts Program for Google Workspace (Google Apps Script) and interested in supporting Google Workspace Devs.
Documentation says “coerce it using input + ”” I am a beginner and Google search did not help explain this.
Hi Lissa – its a little trick to make sure the value you test is a string (required by the library). Hopefully the code snippet helps explain:
const input = 8; // input is a number
input + ''; // value of input is now a string '8'
If you know your input value is always going to be a string no need to do any additional coding