code: function checkWhitelist(str, whitelist, context) {
      if (whitelist.indexOf(str) === -1) {
          throw new ImplementationError(
              'Invalid "' + str + '" (allowed: ' + whitelist.join(', ') + ')' + context.errorContext
          );
      }
      return str;
  }
docs: Validates string against whitelist.
  
  @private