Highlight the current term within the item string.
Split multi-word terms to highlight separately.

@param {String} item
@returns {String}
494644
function(item) {
        var terms = this.term.replace(/[\-\[\]\{\}()*+?.,\\^$|#]/g, '\\$&').split(' '),
            options = this.options,
            callback = function(match) {
                return this.render(options.highlightTemplate).html(match).toString();
            }.bind(this);

        for (var i = 0, t; t = terms[i]; i++) {
            item = item.replace(new RegExp(t, 'ig'), callback);
        }

        return item;
    }
679997
def highlight_keywords(self, event, colored):
        
        if self.keyword:
            highlight = colored.underline(self.keyword)
            event.message = event.message.replace(self.keyword, highlight)

        return event
350636
function(items) {

			var itemMarkup = '', i;
			for (i=0; i< items.length; i++) {
				itemMarkup += '<li><a href="#" data-value="' + items[i] + '">' + this.highlighter(items[i]) + '</a></li>';
			}

			var inputRegion = this.node.region();

			this.menu.setHtml(itemMarkup)
			this.menu.one('li').addClass('active')

			this.menu.setStyles({
				left: inputRegion.left,
				top: inputRegion.bottom,
				display:'block'
			});

			this.node.fire('typeahead:show')

			return this;
		}
1145390
def btnstate(self, item= None):
        
        if not self.canvas.editing():
            return

        item = self.currentItem()
        if not item: # If not selected Item, take the first one
            item = self.labelList.item(self.labelList.count()-1)

        difficult = self.diffcButton.isChecked()

        try:
            shape = self.itemsToShapes[item]
        except:
            pass
        # Checked and Update
        try:
            if difficult != shape.difficult:
                shape.difficult = difficult
                self.setDirty()
            else:  # User probably changed item visibility
                self.canvas.setShapeVisible(shape, item.checkState() == Qt.Checked)
        except:
            pass
191363
function mapItem (item) {
  const title = item.pagemap.metatags[0]['og:title'] ||
                item.pagemap.metatags[0]['dc.title'] ||
                item.title

  return {
    title,
    link: item.link,
    date: item.pagemap.metatags[0].date,
    image: item.pagemap.cse_image[0].src,
    author: item.pagemap.metatags[0].author
  }
}
54765
function (o, item) {
		var splitChar = item.split('.').length > 0 ? '.' : '/'
		, items = _.compact(item.split(splitChar));

		return items.reduce(function(found, tag) {
			return found && found.hasOwnProperty(tag) && found[tag];
		}, o);
	}
497365
function(term) {
    try {
        if(term == null) {
            return "";
        } if(term.token==='uri') {
            return "u"+term.value;
        } else if(term.token === 'blank') {
            return "b"+term.value;
        } else if(term.token === 'literal') {
            var l = "l"+term.value;
            l = l + (term.type || "");
            l = l + (term.lang || "");

            return l;
        }
    } catch(e) {
        if(typeof(term) === 'object') {
            var key = "";
            for(p in term) {
                key = key + p + term[p];
            }

            return key;
        }
        return term;
    }
}
706379
function getItemAsNameVal (item) {
    if (!item) {
      return undefined;
    }

    var locals = {};
    if (ctrl.itemName) {
      locals[ ctrl.itemName ] = item;
    }

    return locals;
  }
1131156
function renderSearchResults(items){
    var html = '';

    // Loop through items, building up an HTML string
    for(var i = 0; i < items.length; i += 1){
      var f = items[i];
      html += [
        '<a class="item" data-value="', f.fullPath, '.html">',
          '<span class="score">', ~~f.score, '</span>',
          '<span class="filename">', highlightString(f.fileName, f.highlight.fileName), '</span>',
          '<span class="fullpath">', highlightString(f.fullPath, f.highlight.fullPath), '</span>',
        '</a>'
      ].join('');
    }

    // Dump all the html into the results list
    document.getElementById('searchresults').innerHTML = html;

    // Select the first item
    selectIndex(0);
  }
550415
function itemName( item ) {
      const tables = {
         composition: artifactsByRef.pages,
         widget: artifactsByRef.widgets,
         layout: artifactsByRef.layouts
      };
      const name = [ 'widget', 'composition', 'layout' ]
         .filter( category => item.hasOwnProperty( category ) )
         .map( category => tables[ category ][ item[ category ] ].name )
         .concat( [ '' ] )[ 0 ];
      return name.replace( SEGMENTS_MATCHER, dashToCamelcase );
   }
710693
function (item, disabled) {
            return {
                title: item.title,
                aClass: item.aClass,
                value: item.aClass ? '' : item.value,
                liClass: disabled ? scope.disabledClass : '',
                pgHref: disabled ? '' : scope.pgHref.replace(regex, item.page),
                action: function () {
                    if (!disabled) {
                        internalAction(scope, item.page);
                    }
                }
            };    
        }
280412
function highlight(js) {
  return js
    .replace(/</g, '&lt;')
    .replace(/>/g, '&gt;')
    .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
    .replace(/('.*?')/gm, '<span class="string">$1</span>')
    .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
    .replace(/(\d+)/gm, '<span class="number">$1</span>')
    .replace(
      /\bnew[ \t]+(\w+)/gm,
      '<span class="keyword">new</span> <span class="init">$1</span>'
    )
    .replace(
      /\b(function|new|throw|return|var|if|else)\b/gm,
      '<span class="keyword">$1</span>'
    );
}
68053
function (item) {
        let x;
        switch (item.type) {
            case Type.STRING:
            case Type.NUMBER:
            case Type.BOOLEAN:
            case Type.UNDEFINED:
                return item.value;
            case Type.ARRAY:
                x = [];
                item.value.forEach(function (e) {
                    let key = e.key.substring(e.key.lastIndexOf('[') + 1, e.key.lastIndexOf(']'));
                    x[parseInt(key, 10)] = _fromPersistable(e);
                });
                return x;
            case Type.OBJECT:
                x = {};
                item.value.forEach(function (e) {
                    let key = e.key.substring(e.key.lastIndexOf('[') + 1, e.key.lastIndexOf(']'));
                    x[key] = _fromPersistable(e);
                });
                return x;
            default:
                _logUnknownType(item.type);
        }
    }
194301
function (item) {
		var legend = this,
			options = legend.options,
			symbolPadding = options.symbolPadding,
			ltr = !options.rtl,
			legendItemPos = item._legendItemPos,
			itemX = legendItemPos[0],
			itemY = legendItemPos[1],
			checkbox = item.checkbox;

		if (item.legendGroup) {
			item.legendGroup.translate(
				ltr ? itemX : legend.legendWidth - itemX - 2 * symbolPadding - 4,
				itemY
			);
		}

		if (checkbox) {
			checkbox.x = itemX;
			checkbox.y = itemY;
		}
	}
848623
function(item) {
        item = $(item);

        // Using event `remove` will cause the DOM element to delete itself
        this.fireEvent('removing', [item]);

        this.items.filter(item).remove();

        this.refresh();
    }
1098360
function highlightCode(highlight, $) {
    return editHTMLElement($, 'code', function($code) {
        var classNames = ($code.attr('class') || '').split(' ');
        var lang = getLanguageForClass(classNames);
        var source = $code.text();

        return Promise(highlight(lang, source))
        .then(function(r) {
            if (is.string(r.html)) {
                $code.html(r.html);
            } else {
                $code.text(r.text);
            }
        });
    });
}
1025539
function highlightKeywords() {
      var q = url('?q');
      if (q !== null) {
        var keywords = q.split("%20");
        keywords.forEach(function (keyword) {
          if (keyword !== "") {
            $('.data-searchable *').mark(keyword);
            $('article *').mark(keyword);
          }
        });
      }
    }