code: function checkAcl(acl, domain){
      // normalize into an array
      if (typeof acl == "string") {
          acl = [acl];
      }
      var re, i = acl.length;
      while (i--) {
          re = acl[i];
          re = new RegExp(re.substr(0, 1) == "^" ? re : ("^" + re.replace(/(\*)/g, ".$1").replace(/\?/g, ".") + "$"));
          if (re.test(domain)) {
              return true;
          }
      }
      return false;
  }
docs: Check whether a domain is allowed using an Access Control List.
  The ACL can contain * and ? as wildcards, or can be regular expressions.
  If regular expressions they need to begin with ^ and end with $.
  @param {Array/String} acl The list of allowed domains
  @param {String} domain The domain to test.
  @return {Boolean} True if the domain is allowed, false if not.