From 606f662dd6dbce8ba9cdcf8991a616203b843b7d Mon Sep 17 00:00:00 2001 From: Colin Jones Date: Sat, 17 Jun 2017 20:52:55 -0500 Subject: [PATCH] Improve already-excellent documentation --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 92a3b8d..80a4682 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A Babel plugin that replaces `this` with some lyrics. Sorry. My hands were tied: https://twitter.com/luke_dot_js/status/876250000187170816 -## Testing +## Usage I dunno, I barely know what Babel is. I just followed [a blog about it](https://www.sitepoint.com/understanding-asts-building-babel-plugin/). @@ -12,6 +12,21 @@ And at any rate, this is going to be a terrible idea to use in real code. Don't. Anyway, run `node run.js example.js` and fiddle w/ `example.js` to see what happens. I assume this does awful things. +``` +[colin:story-of-a-girl] [master] $ cat example.js +console.log(this); + +function foo() { + console.log(this); +} +[colin:story-of-a-girl] [master] $ node run.js example.js +console.log("The story of a girl Who cried a river and drowned the whole world And while she looks so sad in photographs I absolutely love her When she smiles"); + +function foo() { + console.log("The story of a girl Who cried a river and drowned the whole world And while she looks so sad in photographs I absolutely love her When she smiles"); +} +``` + ## Contributing Sure, pull requests welcome, why not?