Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2890902
TypeaheadNormalizer.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
914 B
Referenced Files
None
Subscribers
None
TypeaheadNormalizer.js
View Options
/**
* @requires javelin-install
* @provides javelin-typeahead-normalizer
* @javelin
*/
JX
.
install
(
'TypeaheadNormalizer'
,
{
statics
:
{
/**
* Normalizes a string by lowercasing it and stripping out extra spaces
* and punctuation.
*
* @param string
* @return string Normalized string.
*/
normalize
:
function
(
str
)
{
// NOTE: We specifically normalize "(" and ")" into spaces so that
// we can match tokenizer functions like "members(project)".
// NOTE: We specifically do NOT normalize "\n" because it is used as
// a delimiter between components of typeahead result names, like the
// name of a project and its tags.
return
(
''
+
str
)
.
toLocaleLowerCase
()
.
replace
(
/[\.,\/#!$%\^&\*;:{}=_`~]/g
,
''
)
.
replace
(
/[-\[\]\(\)]/g
,
' '
)
.
replace
(
/ +/g
,
' '
)
.
replace
(
/^\s*|\s*$/g
,
''
);
}
}
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 19, 14:18 (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125429
Default Alt Text
TypeaheadNormalizer.js (914 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment