diff --git a/src/lists.js b/src/lists.js index b676c00c..90653ea8 100644 --- a/src/lists.js +++ b/src/lists.js @@ -922,7 +922,7 @@ List.prototype.asCSV = function () { var items = this.itemsArray(), rows = []; - + function encodeCell(atomicValue) { var string = isNil(atomicValue) ? '' : atomicValue.toString(), cell; @@ -932,7 +932,7 @@ List.prototype.asCSV = function () { return string; } cell = ['\"']; - string.split('').forEach(letter => { + Array.from(string).forEach(letter => { cell.push(letter); if (letter === '\"') { cell.push(letter); @@ -1094,7 +1094,7 @@ List.prototype.blockify = function (limit = 500, count = [0]) { block.isDraggable = true; slots.removeInput(); - + // fill the slots with the data for (i = 0; i < len && count[0] < limit; i += 1) { value = this.at(i + 1); diff --git a/src/threads.js b/src/threads.js index 6da34e25..5284e91b 100644 --- a/src/threads.js +++ b/src/threads.js @@ -4344,15 +4344,16 @@ Process.prototype.reportStringSize = function (data) { }; Process.prototype.reportUnicode = function (string) { - var str; + var str, unicodeList; if (this.enableHyperOps) { if (string instanceof List) { return string.map(each => this.reportUnicode(each)); } str = isNil(string) ? '\u0000' : string.toString(); - if (str.length > 1) { - return this.reportUnicode(new List(str.split(''))); + unicodeList = Array.from(str); + if (unicodeList.length > 1) { + return this.reportUnicode(new List(unicodeList)); } } else { str = isNil(string) ? '\u0000' : string.toString(); @@ -4420,9 +4421,10 @@ Process.prototype.reportBasicTextSplit = function (string, delimiter) { str = str.trim(); del = /\s+/; break; + case isNil(delimiter): + case '': case 'letter': - del = ''; - break; + return new List(Array.from(str)); case 'csv': return this.parseCSV(string); case 'json': @@ -4434,7 +4436,7 @@ Process.prototype.reportBasicTextSplit = function (string, delimiter) { return this.parseCSVfields(string); */ default: - del = isNil(delimiter) ? '' : delimiter.toString(); + del = delimiter.toString(); } return new List(str.split(del)); };