Looks pretty straightforward to me. Do you know what the equivalent AppleScript is?
Edit: found a stack overflow question/answer [1]. It's doing a little additional work beyond searching for mails with a particular subject, but even just the searching functionality is much larger and more convoluted that the single line of js you referenced.
Agree. Hopefully (?) it's just JS by the point we get to `Mail.outgoingMessages` so it should be fairly straightforward to mix-in underscore's methods into whatever their 'collection' representation is, the same way Backbone does [1] to give you map/filter/which etc.
Looking at the sample code in this page:
is doesn't look much better.