InputSanitizer constructors

The complete source of sanitized_constructors.ek9, compiled by the EK9 compiler. Shown on sanitized.html.

#!ek9
defines module site.sanitized.constructors

  defines function

    safeOnEveryRoute()
      -> userInput as String
      <- rtn as Boolean: true

      //Default - always logs threats to stderr
      defaultSanitizer <- InputSanitizer()
      rtn: rtn and defaultSanitizer.isSafe(userInput)

      //With an explicit reporter (here, stderr)
      stderrSanitizer <- InputSanitizer(Stderr())
      rtn: rtn and stderrSanitizer.isSafe(userInput)

Download sanitized_constructors.ek9