Skip to content

Instantly share code, notes, and snippets.

@erikroyall
Last active September 25, 2016 04:09
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 erikroyall/d04aff1cc1e7786567dd3f83908aaf3b to your computer and use it in GitHub Desktop.
Save erikroyall/d04aff1cc1e7786567dd3f83908aaf3b to your computer and use it in GitHub Desktop.
Sweet.js for clone Potato => Object.create(Potato)
syntax clone = function (ctx) {
let ident = ctx.next().value;
return #`Object.create(${ident})`;
}
var Potato = {
meaningOfLife: 42
};
var potato = clone Potato;
potato.meaningOfLife; // 42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment