From 6fccf8df129de06c72a1f88e38c30c4065fed0a7 Mon Sep 17 00:00:00 2001 From: Franco Monsalvo Date: Thu, 14 Feb 2013 18:18:58 -0300 Subject: [PATCH 1/6] modified private naming convention and this naming convention --- README.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c7078dad0d..19bfecd332 100644 --- a/README.md +++ b/README.md @@ -956,21 +956,28 @@ }); ``` - - Use a leading underscore `_` when naming private properties + - Never use a leading underscore `_` when naming private properties ```javascript // bad - this.__firstName__ = 'Panda'; - this.firstName_ = 'Panda'; - + this._firstName__ = 'Panda'; + // good - this._firstName = 'Panda'; + this.firstName = 'Panda'; ``` - - When saving a reference to `this` use `_this`. + - When saving a reference to `this` use `self`, 'parent' or 'that'. ```javascript // bad + function() { + var _this = this; + return function() { + console.log(_this); + }; + } + + // good function() { var self = this; return function() { @@ -978,7 +985,7 @@ }; } - // bad + // good function() { var that = this; return function() { @@ -988,11 +995,12 @@ // good function() { - var _this = this; + var parent = this; return function() { - console.log(_this); + console.log(parent); }; } + ``` - Name your functions. This is helpful for stack traces. From 46b267ef2d9a1c4357a188221ef070ff895e6bc6 Mon Sep 17 00:00:00 2001 From: Franco Monsalvo Date: Thu, 14 Feb 2013 18:20:06 -0300 Subject: [PATCH 2/6] fixed markdown typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 19bfecd332..59e684befa 100644 --- a/README.md +++ b/README.md @@ -960,13 +960,13 @@ ```javascript // bad - this._firstName__ = 'Panda'; + this._firstName = 'Panda'; // good this.firstName = 'Panda'; ``` - - When saving a reference to `this` use `self`, 'parent' or 'that'. + - When saving a reference to `this` use `self`, `parent` or `that`. ```javascript // bad From 7d5ac66ac5af75a335666320d4ff8bdec15e3b24 Mon Sep 17 00:00:00 2001 From: Franco Monsalvo Date: Mon, 25 Feb 2013 09:51:46 -0500 Subject: [PATCH 3/6] changed the title to say "Globant" instead of "airbnb" but still referencing the original work --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59e684befa..0aaaf41d33 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -# Airbnb JavaScript Style Guide() { +# Globant JavaScript Style Guide() { *A mostly reasonable approach to JavaScript* +*Derived from the excellent work done by airbnb [here](https://github.com/airbnb/javascript)* ## Table of Contents From 07748889ce472987cec599f2b12efcd2e30c398b Mon Sep 17 00:00:00 2001 From: Franco Monsalvo Date: Mon, 25 Feb 2013 09:53:37 -0500 Subject: [PATCH 4/6] fixing unnecessary uppercase D --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0aaaf41d33..55a366cac4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Globant JavaScript Style Guide() { *A mostly reasonable approach to JavaScript* -*Derived from the excellent work done by airbnb [here](https://github.com/airbnb/javascript)* +*derived from the excellent work done by airbnb [here](https://github.com/airbnb/javascript)* ## Table of Contents From 4093e927f7f1a7fd633cde4a71518203c5ef327d Mon Sep 17 00:00:00 2001 From: Fernando Cea Date: Thu, 15 Jan 2015 11:11:58 -0300 Subject: [PATCH 5/6] title has changed to Globant --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a4f1d51d69..ee89b5e176 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/airbnb/javascript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -# Airbnb JavaScript Style Guide() { +# Globant JavaScript Style Guide() { *A mostly reasonable approach to JavaScript* From cba4827b645025e59b17a087aab10c3ecf650b5c Mon Sep 17 00:00:00 2001 From: Fernando Cea Date: Thu, 15 Jan 2015 11:26:34 -0300 Subject: [PATCH 6/6] gitter's link deleeted --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index c97078c9a0..461216538e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/airbnb/javascript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - # Globant JavaScript Style Guide() { *A mostly reasonable approach to JavaScript*