mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Merge pull request #514 from braddunbar/result-docs
Clarify documentation for _.result.
This commit is contained in:
@@ -1313,7 +1313,8 @@ _.escape('Curly, Larry & Moe');
|
|||||||
<p id="result">
|
<p id="result">
|
||||||
<b class="header">result</b><code>_.result(object, property)</code>
|
<b class="header">result</b><code>_.result(object, property)</code>
|
||||||
<br />
|
<br />
|
||||||
Returns a value from an object as a property or as a function.
|
If the value of the named property is a function then invoke it.
|
||||||
|
Otherwise, return its value.
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
var object = {cheese: 'crumpets', stuff: function(){ return 'nonsense'; }};
|
var object = {cheese: 'crumpets', stuff: function(){ return 'nonsense'; }};
|
||||||
|
|||||||
@@ -873,7 +873,8 @@
|
|||||||
return (''+string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/');
|
return (''+string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/');
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get a value from an object as a property or as a function.
|
// If the value of the named property is a function then invoke it.
|
||||||
|
// Otherwise, return its value.
|
||||||
_.result = function(object, property) {
|
_.result = function(object, property) {
|
||||||
if (object == null) return null;
|
if (object == null) return null;
|
||||||
var value = object[property];
|
var value = object[property];
|
||||||
|
|||||||
Reference in New Issue
Block a user