Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2019-01-28 14:15:10 -0500
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2019-01-28 14:15:10 -0500
commitc9ab302f5347efc6bd866ae66260098ff85c79aa (patch)
tree043c391a371e44ac0dc8e61dbcc25bd1128f8f5a /src
parent017ca1f4372e59be4132a40e229e638221d960db (diff)
downloadtame-c9ab302f5347efc6bd866ae66260098ff85c79aa.tar.gz
tame-c9ab302f5347efc6bd866ae66260098ff85c79aa.tar.bz2
tame-c9ab302f5347efc6bd866ae66260098ff85c79aa.zip
map: Proper array check for translation iteration
The previous length check existed as a really bad array check (before Array.isArray was a thing). This has been broken since Nov 2012. The problem manifests itself when you want an empty array. We then have: [] => [[]] => [DEFAULT_VALUE] * src/current/compiler/map.xsl (lvmc:compile)[lvm:map//lvm:from[*]]: Use `Array.isArray' in place of length check.
Diffstat (limited to 'src')
-rw-r--r--src/current/compiler/map.xsl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/current/compiler/map.xsl b/src/current/compiler/map.xsl
index a1d6a83..f2c8494 100644
--- a/src/current/compiler/map.xsl
+++ b/src/current/compiler/map.xsl
@@ -745,7 +745,7 @@
<!-- TODO: support arbitrary depth -->
<!-- oval = orig val -->
<text>(function(oval){</text>
- <text>var val = ( (oval||'').length ) ? oval : [oval]; </text>
+ <text>var val = Array.isArray(oval) ? oval : [oval||'']; </text>
<text>var ret = []; </text>
<if test="$nested-depth = 0">