* Pre-process search query input text. * @param {string} text Input text * @returns {string} Processed text
(text)
| 439 | * @returns {string} Processed text |
| 440 | */ |
| 441 | function processInputText(text) { |
| 442 | // Convert to lowercase |
| 443 | text = text.toLowerCase(); |
| 444 | // Remove punctuation |
| 445 | text = text.replace(/[\\.,@#!?$%&;:{}=_~[\]]/g, ''); |
| 446 | // Remove double quotes (including region-specific ones) |
| 447 | text = text.replace(/["“”]/g, ''); |
| 448 | // Remove carriage returns |
| 449 | text = text.replace(/\r/g, ''); |
| 450 | // Replace newlines with spaces |
| 451 | text = text.replace(/[\n]+/g, ' '); |
| 452 | // Collapse multiple spaces into one |
| 453 | text = text.replace(/\s+/g, ' '); |
| 454 | // Trim |
| 455 | text = text.trim(); |
| 456 | |
| 457 | return text; |
| 458 | } |
| 459 | |
| 460 | /** |
| 461 | * Checks if the provided link is allowed to be visited or blacklisted. |
no outgoing calls
no test coverage detected