Skip to content

Commit

Permalink
Add example of not in, closes jashkenas#3281
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyBooth committed May 3, 2017
1 parent a7b0267 commit 71a2204
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 8 additions & 5 deletions docs/v2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1605,17 +1605,20 @@ <h2>Loops and Comprehensions</h2>
<div class="col-md-6 coffeescript-input-column">
<textarea class="coffeescript-input" id="do-coffee">for filename in list
do (filename) ->
fs.readFile filename, (err, contents) ->
compile filename, contents.toString()
if filename not in ['.DS_Store', 'Thumbs.db', 'ehthumbs.db']
fs.readFile filename, (err, contents) ->
compile filename, contents.toString()
</textarea>
</div>
<div class="col-md-6 javascript-output-column">
<textarea class="javascript-output" id="do-js">var filename, fn, i, len;

fn = function(filename) {
return fs.readFile(filename, function(err, contents) {
return compile(filename, contents.toString());
});
if (filename !== '.DS_Store' && filename !== 'Thumbs.db' && filename !== 'ehthumbs.db') {
return fs.readFile(filename, function(err, contents) {
return compile(filename, contents.toString());
});
}
};
for (i = 0, len = list.length; i < len; i++) {
filename = list[i];
Expand Down
5 changes: 3 additions & 2 deletions documentation/examples/do.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
for filename in list
do (filename) ->
fs.readFile filename, (err, contents) ->
compile filename, contents.toString()
if filename not in ['.DS_Store', 'Thumbs.db', 'ehthumbs.db']
fs.readFile filename, (err, contents) ->
compile filename, contents.toString()

0 comments on commit 71a2204

Please sign in to comment.