Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Read element other than Array #182

Closed
wants to merge 1 commit into from

2 participants

@ShankarKamble

Add New method 'element' to async to read element other than Array

@ShankarKamble ShankarKamble Update lib/async.js
Add New method 'element' to async to read element other than Array
8972fdf
@caolan
Owner

I don't see the use case for this.

@caolan caolan closed this
@ShankarKamble

All method in async have need Array as parameter
But In my code need pass one element not array to asyan object . thus i am write this method and do the pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 28, 2012
  1. @ShankarKamble

    Update lib/async.js

    ShankarKamble authored
    Add New method 'element' to async to read element other than Array
This page is out of date. Refresh to see the latest.
Showing with 19 additions and 0 deletions.
  1. +19 −0 lib/async.js
View
19 lib/async.js
@@ -98,6 +98,25 @@
});
};
+// Modified
+// for read element
+async.element = function (element, iterator, callback) {
+ callback = callback || function () {};
+ if (element==null || element=='') {
+ return callback();
+ }
+ iterator(element, function (err) {
+ if (err) {
+ callback(err);
+ callback = function () {};
+ }
+ else {
+ callback(null);
+ }
+ });
+ };
+// Modified
+
async.forEachSeries = function (arr, iterator, callback) {
callback = callback || function () {};
if (!arr.length) {
Something went wrong with that request. Please try again.