code: function createDelimiterRegex(options) {
    const opts = Object.assign({}, options);
    let tagname = options.tagname;
    let layoutDelims = options.delims || options.layoutDelims || `{% (${tagname}) %}`;
    let key = tagname;
  
    if (layoutDelims) key += layoutDelims.toString();
    if (layouts.memo.has(key)) {
      return layouts.memo.get(key);
    }
  
    if (layoutDelims instanceof RegExp) {
      layouts.memo.set(key, layoutDelims);
      return layoutDelims;
    }
  
    if (Array.isArray(layoutDelims)) {
      layoutDelims = `${opts.layoutDelims[0]} (${tagname}) ${opts.layoutDelims[1]}`;
    }
  
    if (typeof layoutDelims !== 'string') {
      throw new TypeError('expected options.layoutDelims to be a string, array or regex');
    }
  
    const regex = new RegExp(layoutDelims, 'g');
    layouts.memo.set(key, regex);
    return regex;
  }
docs: Creates a regular expression to use for matching delimiters, based on
  the given options.