Created
November 1, 2012 08:29
-
-
Save froots/3992487 to your computer and use it in GitHub Desktop.
console.log during an Underscore.js chain()
This file contains hidden or 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
_.chain(myData) | |
.flatten() | |
.log() | |
.reverse() | |
.log() | |
.filter(function(item) { return item.active; }) | |
.value(); |
This file contains hidden or 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
_.mixin({ | |
log: function(arg) { | |
console.log(arguments); | |
return arg; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't know why I didn't do this before. Very handy for quick debugging of intermediate chain states.