Compare commits

...

2 Commits

Author SHA1 Message Date
Sebastian McKenzie
c500532469 v1.13.4 2014-11-23 20:17:14 +11:00
Sebastian McKenzie
3396cc84f1 fix spread not returning a new array with a single spread element 2014-11-23 20:16:10 +11:00
5 changed files with 11 additions and 4 deletions

View File

@@ -1,3 +1,7 @@
# 1.13.4
* Fix single spread element returning itself.
# 1.13.3
* Upgrade `acorn-6to5`.

View File

@@ -48,7 +48,10 @@ exports.ArrayExpression = function (node, parent, file) {
var nodes = build(elements, file);
var first = nodes.shift();
if (!nodes.length) return first;
if (!t.isArrayExpression(first)) {
nodes.unshift(first);
first = t.arrayExpression([]);
}
return t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes);
};

View File

@@ -1,7 +1,7 @@
{
"name": "6to5",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "1.13.3",
"version": "1.13.4",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://github.com/6to5/6to5",
"repository": {

View File

@@ -4,4 +4,4 @@ var _toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
var lyrics = _toArray(parts).concat(["head", "and", "toes"]);
var lyrics = [].concat(_toArray(parts), ["head", "and", "toes"]);

View File

@@ -4,4 +4,4 @@ var _toArray = function (arr) {
return Array.isArray(arr) ? arr : Array.from(arr);
};
_toArray(foo);
[].concat(_toArray(foo));