Last active
January 12, 2019 14:30
-
-
Save knbknb/62936f2a7f9162ebb889bebcdbf98ce1 to your computer and use it in GitHub Desktop.
babeljs transpilation - demo snippets: before: simple, after: complex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this simple snippet will moderately complex after transpiling | |
// https://babeljs.io/repl#?babili=false&browsers=safari%20%3E%209&build=&builtIns=false&spec=false&loose=false&code_lz=G4QwTgBA2iA0BQEnKQIwgXggFgEyxQgHoiIBiCAEwFMAzEAVwBsAXCUJh6gZwEIIAFAEtaEagFsADiwCeEAPaQGAOxq0hy6pQXKIAJQASAZQCUiQkgDGCCwDp74AObd4AXUwRa8-QJMQAPv7QEK4A3BDwQA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env&prettier=false&targets=&version=6.26.0&envVersion=1.6.2 | |
var [a, | |
b = 42, // default values! (if empty or undefined on RHS) | |
c, | |
...args | |
] = foo() || [ ]; | |
// | |
function foo(){ | |
return [1,2,3, [4,5,6]]; | |
} | |
// ... but this simple snippet will become incredibly complex after transpiling | |
// https://babeljs.io/repl#?babili=false&browsers=safari%20%3E%209&build=&builtIns=false&spec=false&loose=false&code_lz=GYVwdgxgLglg9mABMOcAUBKA3gKEfxAJwFMoRCkBtARgBoAmWgZlsUoBZaBWWgNgF1-AbhwBfHDgBuAQ0KJptAEa0ItWQHMAzqwAmtYiJyU8BBSfyKAvInaNziVfcp77te8Xv8c_RNZToMISA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env&prettier=false&targets=&version=6.26.0&envVersion=1.6.2 | |
var a,b,c,args, d,e; | |
[ | |
a, | |
b= 42, | |
c, | |
[d, | |
, | |
e | |
] | |
] = foo(); | |
// ########## another boost of complexity by transpilation | |
// https://babeljs.io/repl#?babili=false&browsers=safari%20%3E%209&build=&builtIns=false&spec=false&loose=false&code_lz=IYZwngdgxgBAZgV2gFwJYHsL3egFADwEoYBvAKBhgDdgAnGMGAXhmAHdhVkZ8KYpMIdABsApgDph6AOa4whMgF8gA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env&prettier=false&targets=&version=6.26.0&envVersion=1.6.2 | |
async function foo(x) { | |
var y = await x | |
console.log(y) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment