How can I handle two one async.each into async.waterfall....Cannot read property 'bodyClass' of undefined

NodeBB Plugins
  • I have this code:

    var array=[];
    async.waterfall([
    			function(called) {
                  var array=[];
              //Suppose to have another array that have some values called total
                     async.forEach(total,function(item,callback){
                       array= array.concat(item);
                    callback();
    
    },function(error){
    called(null,array);
    //but i Obtain this error Cannot read property 'bodyClass' of undefined
    
    });
    
    
    }],function(err,elem){
    });
    
    If there are some syntax error doesn't matter. Anyone can help me?
    
    
    });
    
  • I have no idea where bodyClass comes into play, but maybe this will help:

    var async = require('async');
    
    var total = ['a', 'b'];
    async.waterfall([function(called) {
    	var arr = [1, 2];
    	async.forEach(total, function(item, callback) {
    		arr = arr.concat(item);
    		callback();
    	}, function(error) {
    		called(null, arr);
    	});
    }], function(err, elem) {
    	console.log(err, elem);
    	// Output: null [ 1, 2, 'a', 'b' ]
    
    });
    
  • Is this for a hook of some sort? Please paste the entire function, and which hook you're subscribing to...

  • This post is deleted!


Suggested Topics


  • 0 Votes
    5 Posts
    1586 Views
  • 0 Votes
    4 Posts
    2013 Views
  • 0 Votes
    2 Posts
    1464 Views
  • 0 Votes
    5 Posts
    2038 Views
  • 0 Votes
    1 Posts
    1346 Views