code: function compile(format) {
    /* istanbul ignore if */
    if (typeof format !== 'string') {
      throw new TypeError('argument format must be a string');
    }
    const fmt = format.replace(/"/g, '\\"');
    /* eslint prefer-template:0 */
    const js = '  return "'
      + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, (_, name, arg) => {
        const str = '"\n    + (tokens["' + name + '"](ctx, ';
        return str + String(JSON.stringify(
          arg,
        )) + ') || "-") + "';
      }) + '";';
    /* eslint no-new-func:0 */
    return new Function('tokens, ctx', js);
  }
docs: Compile a format string into a function.
  
  @param {string} format
  @return {function}
  @public