Skip to content

Instantly share code, notes, and snippets.

@froots
Created November 1, 2012 08:29
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save froots/3992487 to your computer and use it in GitHub Desktop.
Save froots/3992487 to your computer and use it in GitHub Desktop.
console.log during an Underscore.js chain()
_.chain(myData)
.flatten()
.log()
.reverse()
.log()
.filter(function(item) { return item.active; })
.value();
_.mixin({
log: function(arg) {
console.log(arguments);
return arg;
}
});
@froots
Copy link
Author

froots commented Nov 1, 2012

Don't know why I didn't do this before. Very handy for quick debugging of intermediate chain states.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment