Created
September 22, 2013 11:50
-
-
Save raine/6659219 to your computer and use it in GitHub Desktop.
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({ | |
| filterWith: function(list, preds) { | |
| return _.filter(list, function(obj) { | |
| var call = function(a, b) { return b(a); }; | |
| return _.every(preds, _.partial(call, obj)); | |
| }); | |
| } | |
| }); | |
| var b = { | |
| isNotConsole : function(buf) { return buf.attributes.buffer_type !== 'console'; }, | |
| isNotArchived : function(buf) { return buf.attributes.archived != true; }, | |
| isUnseen : function(buf) { return buf.unseen; } | |
| }; | |
| var getBuffers = function() { | |
| return _.filterWith(SESSION.buffers.models, _.toArray(arguments)); | |
| }; | |
| getBuffers(b.isNotConsole, b.isNotArchived, b.isUnseen); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment