introducing — an open-source library of string validation for apps script projects

the distant cousin of the already existing validator.js npm module.

introducing — an open-source library of string validation for apps script projects


ever had the task to verify if an input is really an email or a url, was empty or maybe a json, perhaps something else altogether and had to make use of complex regex or a variety of if conditions to do so?

well, no more!

thanks to validator.js — an already existing npm module written in the same style of javascript that's compatible with our regular apps script projects, i was able to copy & modify roughly 98% of the it all to create an apps script library too.

say hello to — 🎉

demo demo demo


here are the 2 things that i had to modify within the original validator.js library -

  1. create a whole bunch of private methods/functions: this comes as part of the best practices too but i had a need to not display a whole bunch of "helper" functions to the users when the autocomplete gets triggered and so had to modify the original library a bit to introduce trailing _s to functions that ought not be seen
  2. adding jsdoc-style documentation: this is applicable when creating custom functions too — allows the library user to better understand the kind of input that's expected within the editor


well, let's face it — i'm not a skilled coder to have written a library from scratch and i knew that the best pieces of code (along with it's complexity) already existed elsewhere. so i did what i thought was best and reached out to the original license owner of the validator.js library to check if it was okay for me to do what i was about to and within an hour, i had an answer 🤩