1
0

set an empty string when string was not provided

preventing TypeError: Cannot read property 'trim' of undefined or TypeError: Cannot read property 'trim' of null
This commit is contained in:
Luiz Freneda
2016-08-31 13:14:28 -03:00
committed by GitHub
parent 48066a1808
commit 1efb5b1e61

View File

@@ -11,6 +11,10 @@ exports.parse = function (string, options) {
options = {};
}
if (!string) {
string = '';
}
// Regularize white spacing
// Make in-between white spaces a unique space
string = string.trim().replace(/\s+/g, ' ');