You've already forked search-query-parser
Merge pull request #6 from lfreneda/null-reference
set an empty string when string was not provided
This commit is contained in:
@@ -11,6 +11,10 @@ exports.parse = function (string, options) {
|
|||||||
options = {};
|
options = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string) {
|
||||||
|
string = '';
|
||||||
|
}
|
||||||
|
|
||||||
// Regularize white spacing
|
// Regularize white spacing
|
||||||
// Make in-between white spaces a unique space
|
// Make in-between white spaces a unique space
|
||||||
string = string.trim().replace(/\s+/g, ' ');
|
string = string.trim().replace(/\s+/g, ' ');
|
||||||
|
|||||||
Reference in New Issue
Block a user