Merge pull request #1330 from cycomachead/issue-1322

Fix a few Integer 0 vs String Errors.
dev
Jens Mönig 2016-07-19 14:39:51 +02:00 zatwierdzone przez GitHub
commit 8ba7c180c9
1 zmienionych plików z 9 dodań i 9 usunięć

Wyświetl plik

@ -2467,16 +2467,16 @@ Process.prototype.reportLetter = function (idx, string) {
return '';
}
var i = +(idx || 0),
str = (string || '').toString();
str = isNil(string) ? '' : string.toString();
return str[i - 1] || '';
};
Process.prototype.reportStringSize = function (string) {
if (string instanceof List) { // catch a common user error
return string.length();
Process.prototype.reportStringSize = function (data) {
if (data instanceof List) { // catch a common user error
return data.length();
}
var str = (string || '').toString();
return str.length;
return isNil(data) ? 0 : data.toString().length;
};
Process.prototype.reportUnicode = function (string) {
@ -2501,10 +2501,10 @@ Process.prototype.reportTextSplit = function (string, delimiter) {
if (!contains(types, delType)) {
throw new Error('expecting a text delimiter instead of a ' + delType);
}
str = (string || '').toString();
str = isNil(string) ? '' string.toString();
switch (this.inputOption(delimiter)) {
case 'line':
// Unicode Compliant Line Splitting (Platform independent)
// Unicode compliant line splitting (platform independent)
// http://www.unicode.org/reports/tr18/#Line_Boundaries
del = /\r\n|[\n\v\f\r\x85\u2028\u2029]/;
break;
@ -2522,7 +2522,7 @@ Process.prototype.reportTextSplit = function (string, delimiter) {
del = '';
break;
default:
del = (delimiter || '').toString();
del = isNil(delimiter) ? '' : delimiter.toString();
}
return new List(str.split(del));
};