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.
master
Mike Gerwitz 2019-01-28 14:15:10 -05:00
parent 017ca1f437
commit c9ab302f53
1 changed files with 1 additions and 1 deletions

View File

@ -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">