Skip to content

Instantly share code, notes, and snippets.

@hanikesn
Created May 27, 2015 22:19
Show Gist options
  • Save hanikesn/8e5e26a255b867a2bb3f to your computer and use it in GitHub Desktop.
Save hanikesn/8e5e26a255b867a2bb3f to your computer and use it in GitHub Desktop.
Javascript Helpers
var chain_deferreds = function (data, f) {
var start = jQuery.Deferred();
var end = data.reduce(function (prev, d) {
return prev.then(function () {
return f(d);
});
}, start);
start.resolve();
return end;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment