should any of this be enough?
formatted = opts.formatResult(result, $(label), query, self.opts.escapeMarkup);

or fell better with...

label = $(label);
formatted = opts.formatResult(result, label, query, self.opts.escapeMarkup);