Skip to content

Instantly share code, notes, and snippets.

@flarnie
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flarnie/4a88602622fe8f44a8d9 to your computer and use it in GitHub Desktop.
Save flarnie/4a88602622fe8f44a8d9 to your computer and use it in GitHub Desktop.
ES6 transpiler example: how webpack's es-6-loader transforms our ES6 code.
// ES6 syntax
postsCollection.each((post) => {
if (post.get('highlighted')) {
this.highlightedPosts.push(post);
}
});
// The translated version output by webpack
var this$0 = this;
postsCollection.each(function(post) {
if (post.get('highlighted')) {
this$0.highlightedPosts.push(post);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment