Tiny optimization: you could check `item.name` before calling `_getCondensedForm()`. (i.e. instead of setting a `condensedPatterns` var, replace it above with `var itemLabel = item.name || _getCondensedForm(item.patterns)`.)