1
0

Merge pull request #6 from lfreneda/null-reference

set an empty string when string was not provided
This commit is contained in:
Julien Buty
2016-09-01 14:58:35 +08:00
committed by GitHub

View File

@@ -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, ' ');