Module: wakabtcha/lib/answer-generator

Module that generates answers (random strings) for captcha challenge. This file is port of original wakaba source code.
Source:
See:

Members

(package, inner, constant) DEFAULT_GRAMMAR :Object.<String, Array.<String>>

Grammar object for L-system. L-system starts with axiom string, that acts as a template. This object describes rules of L-system. All substrings enclosed in % symbols (e.g. "%W%") are recursively replaced by random string from array from this object's field where key matches substring.
Type:
  • Object.<String, Array.<String>>
Source:
See:
Example
"%W%" => "%C%%T%" => "l%V%%F%" => "lock"

Methods

(inner) cfg_expand(str, grammar) → {String}

Generate string based on L-system described by grammar object This method is direct port from wakautils.pl
Parameters:
Name Type Description
str String Starting string
grammar Object Grammar object
Source:
See:
Returns:
Resulting string
Type
String