remove es20xx prefixes from plugins and rename folders (#6575)

This commit is contained in:
Henry Zhu
2017-10-28 20:43:15 -04:00
committed by GitHub
parent 92a3caeb9c
commit 9ac326b075
1672 changed files with 1200 additions and 1203 deletions

View File

@@ -0,0 +1,13 @@
var [a, b] = [1, 2];
var [[a, b]] = [[1, 2]];
var [a, b, ...c] = [1, 2, 3, 4];
var [[a, b, ...c]] = [[1, 2, 3, 4]];
var [a, b] = [1, 2, 3];
var [[a, b]] = [[1, 2, 3]];
var [a, b] = [a, b];
[a[0], a[1]] = [a[1], a[0]];
var [a, b] = [...foo, bar];
var [a, b] = [foo(), bar];
var [a, b] = [clazz.foo(), bar];
var [a, b] = [clazz.foo, bar];

View File

@@ -0,0 +1,36 @@
var a = 1,
b = 2;
var a = 1,
b = 2;
var a = 1,
b = 2,
c = [3, 4];
var a = 1,
b = 2,
c = [3, 4];
var _ref = [1, 2, 3],
a = _ref[0],
b = _ref[1];
var _ref2 = [1, 2, 3],
a = _ref2[0],
b = _ref2[1];
var _ref3 = [a, b],
a = _ref3[0],
b = _ref3[1];
var _ref4 = [a[1], a[0]];
a[0] = _ref4[0];
a[1] = _ref4[1];
var _ref5 = [].concat(babelHelpers.toConsumableArray(foo), [bar]),
a = _ref5[0],
b = _ref5[1];
var _ref6 = [foo(), bar],
a = _ref6[0],
b = _ref6[1];
var _ref7 = [clazz.foo(), bar],
a = _ref7[0],
b = _ref7[1];
var _ref8 = [clazz.foo, bar],
a = _ref8[0],
b = _ref8[1];

View File

@@ -0,0 +1,3 @@
var [a, [b], [c]] = ["hello", [", ", "junk"], ["world"]];
[a, [b], [c]] = ["hello", [", ", "junk"], ["world"]];
;

View File

@@ -0,0 +1,9 @@
var a = "hello",
_ref = [", ", "junk"],
b = _ref[0],
c = "world";
a = "hello";
var _ref2 = [", ", "junk"];
b = _ref2[0];
c = "world";
;

View File

@@ -0,0 +1,5 @@
var x, y;
var _ref = [1, 2];
x = _ref[0];
y = _ref[1];
_ref;

View File

@@ -0,0 +1,2 @@
var z = {};
var { x: { y } = {} } = z;

View File

@@ -0,0 +1,4 @@
var z = {};
var _z$x = z.x;
_z$x = _z$x === void 0 ? {} : _z$x;
var y = _z$x.y;

View File

@@ -0,0 +1 @@
console.log([x] = [123]);

View File

@@ -0,0 +1,3 @@
var _ref;
console.log((_ref = [123], x = _ref[0], _ref));

View File

@@ -0,0 +1,7 @@
var _f = f();
var _f2 = babelHelpers.slicedToArray(_f, 2);
a = _f2[0];
b = _f2[1];
;

View File

@@ -0,0 +1,6 @@
var a, b, c, d;
({ a, b } = { c, d } = { a: 1, b: 2, c: 3, d: 4});
assert.equal(a, 1);
assert.equal(b, 2);
assert.equal(c, 3);
assert.equal(d, 4);

View File

@@ -0,0 +1,17 @@
var f0 = function (a, b = a, c = b) {
return [a, b, c];
};
assert.deepEqual(f0(1), [1, 1, 1]);
var f1 = function ({a}, b = a, c = b) {
return [a, b, c];
};
assert.deepEqual(f1({a: 1}), [1, 1, 1]);
var f2 = function ({a}, b = a, c = a) {
return [a, b, c];
};
assert.deepEqual(f2({a: 1}), [1, 1, 1]);

View File

@@ -0,0 +1,17 @@
var f0 = function (a, b = a, c = b) {
return [a, b, c];
};
assert.deepEqual(f0(1), [1, 1, 1]);
var f1 = function ({a}, b = a, c = b) {
return [a, b, c];
};
assert.deepEqual(f1({a: 1}), [1, 1, 1]);
var f2 = function ({a}, b = a, c = a) {
return [a, b, c];
};
assert.deepEqual(f2({a: 1}), [1, 1, 1]);

View File

@@ -0,0 +1,29 @@
var f0 = function (a) {
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : a;
var c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : b;
return [a, b, c];
};
assert.deepEqual(f0(1), [1, 1, 1]);
var f1 = function (_ref) {
var a = _ref.a;
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : a;
var c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : b;
return [a, b, c];
};
assert.deepEqual(f1({
a: 1
}), [1, 1, 1]);
var f2 = function (_ref2) {
var a = _ref2.a;
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : a;
var c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : a;
return [a, b, c];
};
assert.deepEqual(f2({
a: 1
}), [1, 1, 1]);

View File

@@ -0,0 +1,3 @@
assert.throws(function () {
var {} = null;
}, /Cannot destructure undefined/);

View File

@@ -0,0 +1,2 @@
var _ref = null;
babelHelpers.objectDestructuringEmpty(_ref);

View File

@@ -0,0 +1 @@
var [, a, [b], [c], d] = ["foo", "hello", [", ", "junk"], ["world"]];

View File

@@ -0,0 +1,7 @@
var _ref = ["foo", "hello", [", ", "junk"], ["world"]],
a = _ref[1],
_ref$ = babelHelpers.slicedToArray(_ref[2], 1),
b = _ref$[0],
_ref$2 = babelHelpers.slicedToArray(_ref[3], 1),
c = _ref$2[0],
d = _ref[4];

View File

@@ -0,0 +1,7 @@
var z = {};
var { ...x } = z;
var { x, ...y } = z;
var { [x]: x, ...y } = z;
(function({ x, ...y }) { });
({ x, y, ...z } = o);

View File

@@ -0,0 +1,20 @@
var z = {};
var _z = z,
x = babelHelpers.objectWithoutProperties(_z, []);
var _z2 = z,
x = _z2.x,
y = babelHelpers.objectWithoutProperties(_z2, ["x"]);
var _z3 = z,
x = _z3[x],
y = babelHelpers.objectWithoutProperties(_z3, [x]);
(function (_ref) {
var x = _ref.x,
y = babelHelpers.objectWithoutProperties(_ref, ["x"]);
});
var _o = o;
x = _o.x;
y = _o.y;
z = babelHelpers.objectWithoutProperties(_o, ["x", "y"]);
_o;

View File

@@ -0,0 +1,2 @@
export let {a, b, c: {d, e: {f = 4}}} = {};

View File

@@ -0,0 +1,8 @@
var _ref = {},
a = _ref.a,
b = _ref.b,
_ref$c = _ref.c,
d = _ref$c.d,
_ref$c$e$f = _ref$c.e.f,
f = _ref$c$e$f === void 0 ? 4 : _ref$c$e$f;
export { a, b, d, f };

View File

@@ -0,0 +1,3 @@
for (var [name, value] in obj) {
print("Name: " + name + ", Value: " + value);
}

View File

@@ -0,0 +1,7 @@
for (var _ref in obj) {
var _ref2 = babelHelpers.slicedToArray(_ref, 2);
var name = _ref2[0];
var value = _ref2[1];
print("Name: " + name + ", Value: " + value);
}

View File

@@ -0,0 +1,2 @@
for (let [ i, n ] = range; ; ) {
}

View File

@@ -0,0 +1 @@
for (var _range = range, _range2 = babelHelpers.slicedToArray(_range, 2), i = _range2[0], n = _range2[1];;) {}

View File

@@ -0,0 +1,3 @@
for (var [ name, before, after ] of test.expectation.registers) {
}

View File

@@ -0,0 +1,7 @@
for (var _ref of test.expectation.registers) {
var _ref2 = babelHelpers.slicedToArray(_ref, 3);
var name = _ref2[0];
var before = _ref2[1];
var after = _ref2[2];
}

View File

@@ -0,0 +1,4 @@
let list = [1, 2, 3, 4];
for (let i = 0, { length } = list; i < length; i++) {
list[i];
}

View File

@@ -0,0 +1,5 @@
var list = [1, 2, 3, 4];
for (var i = 0, length = list.length; i < length; i++) {
list[i];
}

View File

@@ -0,0 +1,9 @@
const assign = function([...arr], index, value) {
arr[index] = value;
return arr;
}
const arr = [1, 2, 3];
assign(arr, 1, 42);
assert.deepEqual(arr, [1, 2, 3]);

View File

@@ -0,0 +1,6 @@
(function () {
let q;
let w;
let e;
if (true) [q, w, e] = [1, 2, 3].map(()=>123);
})();

View File

@@ -0,0 +1,17 @@
(function () {
var q;
var w;
var e;
if (true) {
var _map = [1, 2, 3].map(function () {
return 123;
});
var _map2 = babelHelpers.slicedToArray(_map, 3);
q = _map2[0];
w = _map2[1];
e = _map2[2];
}
})();

View File

@@ -0,0 +1,3 @@
{
"plugins": ["external-helpers", "transform-arrow-functions", "transform-destructuring", "transform-spread", "transform-parameters", "transform-block-scoping", "proposal-object-rest-spread", "transform-regenerator"]
}

View File

@@ -0,0 +1 @@
if (true) [a, b] = [b, a];

View File

@@ -0,0 +1,6 @@
if (true) {
var _ref = [b, a];
a = _ref[0];
b = _ref[1];
_ref;
}

View File

@@ -0,0 +1,3 @@
import { NestedObjects } from "./some-module"
const { Foo, Bar } = NestedObjects

View File

@@ -0,0 +1,6 @@
"use strict";
var _someModule = require("./some-module");
const Foo = _someModule.NestedObjects.Foo,
Bar = _someModule.NestedObjects.Bar;

View File

@@ -0,0 +1,3 @@
{
"plugins": ["transform-destructuring", "transform-modules-commonjs"]
}

View File

@@ -0,0 +1,2 @@
var z = [];
var [x, ...y] = z;

View File

@@ -0,0 +1,3 @@
var z = [];
var x = z[0],
y = z.slice(1);

View File

@@ -0,0 +1,2 @@
[foo.foo, foo.bar] = [1, 2];
;

View File

@@ -0,0 +1,4 @@
var _ref = [1, 2];
foo.foo = _ref[0];
foo.bar = _ref[1];
;

View File

@@ -0,0 +1,2 @@
var rect = {};
var {topLeft: [x1, y1], bottomRight: [x2, y2] } = rect;

View File

@@ -0,0 +1,8 @@
var rect = {};
var _rect$topLeft = babelHelpers.slicedToArray(rect.topLeft, 2),
x1 = _rect$topLeft[0],
y1 = _rect$topLeft[1],
_rect$bottomRight = babelHelpers.slicedToArray(rect.bottomRight, 2),
x2 = _rect$bottomRight[0],
y2 = _rect$bottomRight[1];

View File

@@ -0,0 +1,3 @@
var coords = [1, 2];
var { x, y } = coords,
foo = "bar";

View File

@@ -0,0 +1,4 @@
var coords = [1, 2];
var x = coords.x,
y = coords.y,
foo = "bar";

View File

@@ -0,0 +1,3 @@
var rect = {};
var {topLeft: {x: x1, y: y1}, bottomRight: {x: x2, y: y2}} = rect;
var { 3: foo, 5: bar } = [0, 1, 2, 3, 4, 5, 6];

View File

@@ -0,0 +1,10 @@
var rect = {};
var _rect$topLeft = rect.topLeft,
x1 = _rect$topLeft.x,
y1 = _rect$topLeft.y,
_rect$bottomRight = rect.bottomRight,
x2 = _rect$bottomRight.x,
y2 = _rect$bottomRight.y;
var _ref = [0, 1, 2, 3, 4, 5, 6],
foo = _ref[3],
bar = _ref[5];

View File

@@ -0,0 +1,2 @@
var coords = [1, 2];
var { x, y } = coords;

View File

@@ -0,0 +1,3 @@
var coords = [1, 2];
var x = coords.x,
y = coords.y;

View File

@@ -0,0 +1,3 @@
{
"plugins": ["external-helpers", "transform-destructuring", "transform-spread", "transform-parameters", "transform-block-scoping", "proposal-object-rest-spread", "transform-regenerator"]
}

View File

@@ -0,0 +1,15 @@
function somethingAdvanced({topLeft: {x: x1, y: y1} = {}, bottomRight: {x: x2, y: y2} = {}}, p2, p3){
}
function unpackObject({title: title, author: author}) {
return title + " " + author;
}
console.log(unpackObject({title: "title", author: "author"}));
var unpackArray = function ([a, b, c], [x, y, z]) {
return a+b+c;
};
console.log(unpackArray(["hello", ", ", "world"], [1, 2, 3]));

View File

@@ -0,0 +1,37 @@
function somethingAdvanced(_ref, p2, p3) {
var _ref$topLeft = _ref.topLeft;
_ref$topLeft = _ref$topLeft === void 0 ? {} : _ref$topLeft;
var x1 = _ref$topLeft.x,
y1 = _ref$topLeft.y,
_ref$bottomRight = _ref.bottomRight;
_ref$bottomRight = _ref$bottomRight === void 0 ? {} : _ref$bottomRight;
var x2 = _ref$bottomRight.x,
y2 = _ref$bottomRight.y;
}
function unpackObject(_ref2) {
var title = _ref2.title,
author = _ref2.author;
return title + " " + author;
}
console.log(unpackObject({
title: "title",
author: "author"
}));
var unpackArray = function (_ref3, _ref4) {
var _ref5 = babelHelpers.slicedToArray(_ref3, 3),
a = _ref5[0],
b = _ref5[1],
c = _ref5[2];
var _ref6 = babelHelpers.slicedToArray(_ref4, 3),
x = _ref6[0],
y = _ref6[1],
z = _ref6[2];
return a + b + c;
};
console.log(unpackArray(["hello", ", ", "world"], [1, 2, 3]));

View File

@@ -0,0 +1,7 @@
function* f() {
for (var i = 0; i < 3; i++) {
yield i;
}
}
var [...xs] = f();
assert.deepEqual(xs, [0, 1, 2]);

View File

@@ -0,0 +1,5 @@
function isSorted([x, y, ...wow]) {
if (!zs.length) return true
if (y > x) return isSorted(zs)
return false
}

View File

@@ -0,0 +1,10 @@
function isSorted(_ref) {
var _ref2 = babelHelpers.toArray(_ref),
x = _ref2[0],
y = _ref2[1],
wow = _ref2.slice(2);
if (!zs.length) return true;
if (y > x) return isSorted(zs);
return false;
}

View File

@@ -0,0 +1,3 @@
import runner from "@babel/helper-plugin-test-runner";
runner(__dirname);