Sha256: f09901894c42e98bdd79293498fa26351db14c12c9ba7c09fbd67e37c247cfee
Contents?: true
Size: 703 Bytes
Versions: 8
Compression:
Stored size: 703 Bytes
Contents
/** * Wraps the * @param text {string} haystack to search through * @param search {string} needle to search for * @param [caseSensitive] {boolean} optional boolean to use case-sensitive searching */ angular.module('ui.filters').filter('highlight', function () { return function (text, search, caseSensitive) { if (search || angular.isNumber(search)) { text = text.toString(); search = search.toString(); if (caseSensitive) { return text.split(search).join('<span class="ui-match">' + search + '</span>'); } else { return text.replace(new RegExp(search, 'gi'), '<span class="ui-match">$&</span>'); } } else { return text; } }; });
Version data entries
8 entries across 8 versions & 1 rubygems