Skip to content

Commit 3f9ff91

Browse files
committed
Revision as per review comments by @gkatsev in #451.
1 parent 0186848 commit 3f9ff91

File tree

1 file changed

+4
-37
lines changed

1 file changed

+4
-37
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ this does not mean, you have to avoid all new JavaScript features like list
7373
comprehension or generators. Use them, when they make sense, but don't use them
7474
when the resulting code is hard to read.
7575

76+
**Please stick to using only standards compliant JavaScript.**
77+
7678
#### The most important style issues are:
7779

7880
- Use 4 spaces to indent things, no tabs, not 2, nor 8 spaces. If you use Vim,
@@ -145,29 +147,6 @@ when the resulting code is hard to read.
145147
unfrob();
146148
```
147149

148-
- Prefer lambda-style functions where suitable:
149-
150-
```javascript
151-
// Good
152-
list.filter(function (elem) elem.good != elem.BAD);
153-
list.forEach(function (elem) { window.alert(elem); });
154-
155-
// Bad
156-
list.filter(function (elem) { return elem.good != elem.BAD });
157-
list.forEach(function (elem) window.alert(elem));
158-
```
159-
160-
- Anonymous function definitions should be formatted with a space after the
161-
keyword `function`:
162-
163-
```javascript
164-
// Good
165-
function () {}
166-
167-
// Bad
168-
function() {}
169-
```
170-
171150
- Prefer the use of `let` over `var` i.e. only use `var` when required.
172151

173152
For more details, see:
@@ -195,20 +174,8 @@ when the resulting code is hard to read.
195174

196175
- Use UNIX new lines (`\n`), not windows (`\r\n`) or old Mac ones (`\r`).
197176

198-
- Use `Iterator` or `Array#forEach` to iterate over arrays.
199-
200-
`for (let i in ary)` and `for each (let i in ary)` include members in an
201-
`Array.prototype`, which some extensions alter:
202-
203-
```javascript
204-
// Good
205-
for (let [,elem] in Iterator(ary))
206-
for (let [k, v] in Iterator(obj))
207-
ary.forEach(function (elem) { ...
208-
209-
// Bad
210-
for each (let elem in ary)
211-
```
177+
- Prefer Array iterator functions `Array#forEach` and `Array#map` over loops
178+
and array comprehensions.
212179

213180
The exceptions to this rule are for objects with `__iterator__` set, and for
214181
XML objects (see README.E4X).

0 commit comments

Comments
 (0)