documentcloud/underscore — pull request #1153 by davegurnell (2013-06-20 09:20:18+00:00)
Title: Make the `property` argument of `_.result` optional

The current implementation of `_.result` conflates function invocation and property access (similar to `_.pluck`). This PR adds a single-argument form of `_.result` that can be used for the former without the latter.

If the `property` argument is omitted, the modified `_.result` operates on the `object` argument itself rather than a property of `object`. For example:

var str = 'foo';
var fun = function() { return str; }
_.result(str) // --> 'foo'
_.result(fun) // --> 'foo'

The original two-argument behaviour of `_.result` is retained.