remove Ox.highlight
This commit is contained in:
parent
191d7b3099
commit
ce3c5a4a03
1 changed files with 0 additions and 14 deletions
|
@ -44,25 +44,11 @@ Ox.endsWith <f> Checks if a string ends with a given substring
|
|||
true
|
||||
@*/
|
||||
Ox.ends = Ox.endsWith = function(string, substring) {
|
||||
// fixme: rename to ends
|
||||
string = string.toString();
|
||||
substring = substring.toString();
|
||||
return string.slice(string.length - substring.length) == substring;
|
||||
};
|
||||
|
||||
/*@
|
||||
Ox.highlight <f> Highlight matches in a string
|
||||
> Ox.highlight('foobar', 'foo', 'match')
|
||||
'<span class="match">foo</span>bar'
|
||||
@*/
|
||||
// fixme: with regexp, special chars have to be escaped
|
||||
Ox.highlight = function(txt, str, classname) {
|
||||
return str && str.length ? txt.replace(
|
||||
new RegExp('(' + str + ')', 'ig'),
|
||||
'<span class="' + classname + '">$1</span>'
|
||||
) : txt;
|
||||
};
|
||||
|
||||
/*@
|
||||
Ox.isValidEmail <f> Tests if a string is a valid e-mail address
|
||||
(str) -> <b> True if the string is a valid e-mail address
|
||||
|
|
Loading…
Reference in a new issue