Skip to content

Commit

Permalink
Tweak _.result docs a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
braddunbar committed Mar 8, 2013
1 parent d1b4f49 commit 252aa3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,8 @@ <h2 id="utility">Utility Functions</h2>
<p id="result">
<b class="header">result</b><code>_.result(object, property)</code>
<br />
If the value of the named property is a function then invoke it; otherwise, return it.
If the value of the named <b>property</b> is a function then invoke it
with the <b>object</b> as context; otherwise, return it.
</p>
<pre>
var object = {cheese: 'crumpets', stuff: function(){ return 'nonsense'; }};
Expand Down
4 changes: 2 additions & 2 deletions underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1066,8 +1066,8 @@
};
});

// If the value of the named property is a function then invoke it;
// otherwise, return it. If it is a function it will be bound to that object.
// If the value of the named `property` is a function then invoke it with the
// `object` as context; otherwise, return it.
_.result = function(object, property) {
if (object == null) return void 0;
var value = object[property];
Expand Down

0 comments on commit 252aa3c

Please sign in to comment.