Created
January 27, 2015 14:23
-
-
Save peny/b7626e5f8f16f7800492 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateData(data,callback){ | |
var funcs = { | |
agent: function(data,cb){data.agent = 123; cb(null,data)}, | |
advisor: function(data,cb){data.advisor = 'coolname'; cb(null,data)}, | |
amount: function(data,cb){data.amount = data.amount+1; cb(null,data)} | |
}; | |
//async.series eller något istället för _.each | |
_.each(_.keys(data),function(changedKey){ | |
funcs[changedKey](data,function(){}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment