Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support plain ES6 without transpile #14

Open
suntong opened this issue Feb 18, 2018 · 2 comments
Open

Support plain ES6 without transpile #14

suntong opened this issue Feb 18, 2018 · 2 comments

Comments

@suntong
Copy link

suntong commented Feb 18, 2018

The current option of COMPILER are:

  • babel (6)
  • babel (5)
  • traceur
  • typescript
  • regenerator
  • prepack

Please provide an option of no transpile (or JavaScript) so that people can try out plain ES6 as-is without transpile. Thx.

@suntong
Copy link
Author

suntong commented Feb 19, 2018

I'm new to JavaScript/ES6, so I need to know the exact behavior of JavaScript/ES6, not babel -- the following code behaves differently when run directly under JavaScript/ES6, or after babel transpile:

var obj1 = {a: 1, b: 2}; 
var obj3 = Object.assign({},obj1, obj2);
var obj2 = {a: 4, c: 110}; 
console.log(obj3);
obj3 = Object.assign({},obj1, obj2);
console.log(obj3);

@suntong
Copy link
Author

suntong commented Feb 21, 2018

Found another one,

https://es6console.com/jdxg96oh/

String.prototype.interpolate = function(params) {
  const names = Object.keys(params);
  const vals = Object.values(params);
  return new Function(...names, `return \`${this}\`;`)(...vals);
}

const template = 'Example text: ${text}';
const result = template.interpolate({
  text: 'Foo Boo'
});
console.log(result);

it's just plain normal ES6, but can't run in es6console.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant