Fix listContents

for the forkphorus test suite
This commit is contained in:
Thomas Weber committed 2020-08-03 01:37:14 -05:00
1 parent 3cda97516a
commit 20a60d8e1c
1 file changed
+4 -1
+4 -1
View File
@@ -410,11 +410,14 @@ const listIndexOf = (list, item) => {
/**
* Get the stringified form of a list.
* @param {import('../engine/variable')} list The list.
* @returns {string} Stringified form of the list.
*/
const listContents = (list) => {
for (let i = 0; i < list.value.length; i++) {
const listItem = list.value[i];
if (!(typeof listItem === 'string' && listItem.length === 1)) {
// this is an intentional break from what scratch 3 does to address our automatic string -> number conversions
// it fixes more than it breaks
if ((listItem + '').length !== 1) {
return list.value.join(' ');
}
}