Merge branch 'master' into 3.0.0

Conflicts:
	CHANGELOG.md
	lib/6to5/transformation/transform.js
This commit is contained in:
Sebastian McKenzie
2015-01-21 17:56:34 +11:00
17 changed files with 134 additions and 40 deletions

View File

@@ -0,0 +1,19 @@
function required(msg) {
throw new Error(msg);
}
function sum(
{ arr = required('arr is required') } = { arr: arr = [] },
length = arr.length
) {
let i = 0;
let acc = 0;
for (let item of arr) {
if (i >= length) return acc;
acc += item;
i++;
}
return acc;
}
assert.equal(sum({arr:[1,2]}), 3);

View File

@@ -0,0 +1,2 @@
var foo = [];
assert.deepEqual([for (foo of [1, 2, 3]) foo], [1, 2, 3]);

View File

@@ -0,0 +1,3 @@
{
"experimental": true
}

View File

@@ -0,0 +1,6 @@
let x = 0;
for (;;) {
let x = 1;
assert.equal(x, 1);
break;
}

View File

@@ -0,0 +1,5 @@
var fields = [{ name: "title" }, { name: "content" }];
for (let { name, value = "Default value" } of fields) {
assert.equal(value, "Default value");
}