mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Make Array.join ignore null values (fix #289)
This commit is contained in:
parent
5c491c38c9
commit
40a989c25c
@ -2,6 +2,7 @@
|
||||
Support floating-point literals without a leading 0 - eg '.5' (fix #296)
|
||||
Fix array access with booleans (fix #290)
|
||||
Fix "==" issues where only one argument is an array (fix #283)
|
||||
Make Array.join ignore null values (fix #289)
|
||||
|
||||
1v60 : Fix unary plug on variable not working (fix #268)
|
||||
Added DNS with eth.setIP() for W5500
|
||||
|
||||
@ -1863,7 +1863,7 @@ JsVar *jsvArrayJoin(JsVar *arr, JsVar *filler) {
|
||||
}
|
||||
// add the value
|
||||
JsVar *value = jsvIteratorGetValue(&it);
|
||||
if (value) {
|
||||
if (value && !jsvIsNull(value)) {
|
||||
JsVar *valueStr = jsvAsString(value, true /* UNLOCK */);
|
||||
if (valueStr) { // could be out of memory
|
||||
jsvAppendStringVarComplete(str, valueStr);
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
// test for array join
|
||||
var a = [1,2,4,5,7];
|
||||
|
||||
result = a.join(",")=="1,2,4,5,7";
|
||||
// https://github.com/espruino/Espruino/issues/289
|
||||
var b = ["true", undefined, true, null];
|
||||
|
||||
result = a.join(",")=="1,2,4,5,7" && b.join()=="true,,true,";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user