Rebuild dist files.

This commit is contained in:
John-David Dalton
2014-01-17 09:27:27 -08:00
parent c1d3fc1b78
commit b1fd4e853c
6 changed files with 113 additions and 92 deletions

View File

@@ -4842,36 +4842,43 @@
/**
* Resolves the value of property `key` on `object`. If `key` is a function
* it will be invoked with the `this` binding of `object` and its result returned,
* else the property value is returned. If `object` is falsey then `undefined`
* is returned.
* it will be invoked with the `this` binding of `object` and its result
* returned, else the property value is returned. If `object` is `null` or
* `undefined` then `undefined` is returned. If a default value is provided
* it will be returned if the property value resolves to `undefined`.
*
* @static
* @memberOf _
* @category Utilities
* @param {Object} object The object to inspect.
* @param {string} key The name of the property to resolve.
* @param {*} [defaultValue] The value returned if the property value
* resolves to `undefined`.
* @returns {*} Returns the resolved value.
* @example
*
* var object = {
* 'cheese': 'crumpets',
* 'stuff': function() {
* return 'nonsense';
* 'name': 'fred',
* 'age': function() {
* return 40;
* }
* };
*
* _.result(object, 'cheese');
* // => 'crumpets'
* _.result(object, 'name');
* // => 'fred'
*
* _.result(object, 'stuff');
* // => 'nonsense'
* _.result(object, 'age');
* // => 40
*
* _.result(object, 'employer', 'slate');
* // => 'slate'
*/
function result(object, key) {
if (object) {
var value = object[key];
return isFunction(value) ? object[key]() : value;
function result(object, key, defaultValue) {
if (object == null) {
return defaultValue;
}
var value = typeof object[key] != 'undefined' ? object[key] : defaultValue;
return isFunction(value) ? object[key]() : value;
}
/**