[Pkg-javascript-commits] [node-async] 452/480: Update README.md
Jonas Smedegaard
js at moszumanska.debian.org
Fri May 2 08:58:51 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository node-async.
commit 8a5ebb1132f70fe19747cff8f371bd92b6a9a75b
Author: Bei Jia <bjia927 at gmail.com>
Date: Wed Apr 9 10:59:34 2014 -0500
Update README.md
Fixing example on .each
---
README.md | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index 1835942..dd40026 100644
--- a/README.md
+++ b/README.md
@@ -199,26 +199,23 @@ async.each(openFiles, saveFile, function(err){
```
```js
-// assuming openFiles is an array of file names and saveFile is a function
-// to save the modified contents of that file:
+// assuming openFiles is an array of file names
async.each(openFiles, function( file, callback) {
// Perform operation on file here.
console.log('Processing file ' + file);
- callback();
-
+
if( file.length > 32 ) {
console.log('This file name is too long');
callback('File name too long');
-
- return;
} else {
- console.log('File saved');
+ // Do work To process file here
+ console.log('File processed');
callback();
}
}, function(err){
- // if any of the saves produced an error, err would equal that error
+ // if any of the file processing produced an error, err would equal that error
if( err ) {
// One of the iterations produced an error.
// All processing will now stop.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-async.git
More information about the Pkg-javascript-commits
mailing list