mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Remove references to _.
This commit is contained in:
13
result.js
13
result.js
@@ -3,13 +3,12 @@ import isFunction from './isFunction.js';
|
||||
import toKey from './_toKey.js';
|
||||
|
||||
/**
|
||||
* This method is like `_.get` except that if the resolved value is a
|
||||
* This method is like `get` except that if the resolved value is a
|
||||
* function it's invoked with the `this` binding of its parent object and
|
||||
* its result is returned.
|
||||
*
|
||||
* @static
|
||||
* @since 0.1.0
|
||||
* @memberOf _
|
||||
* @category Object
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Array|string} path The path of the property to resolve.
|
||||
@@ -17,18 +16,18 @@ import toKey from './_toKey.js';
|
||||
* @returns {*} Returns the resolved value.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
|
||||
* var object = { 'a': [{ 'b': { 'c1': 3, 'c2': constant(4) } }] };
|
||||
*
|
||||
* _.result(object, 'a[0].b.c1');
|
||||
* result(object, 'a[0].b.c1');
|
||||
* // => 3
|
||||
*
|
||||
* _.result(object, 'a[0].b.c2');
|
||||
* result(object, 'a[0].b.c2');
|
||||
* // => 4
|
||||
*
|
||||
* _.result(object, 'a[0].b.c3', 'default');
|
||||
* result(object, 'a[0].b.c3', 'default');
|
||||
* // => 'default'
|
||||
*
|
||||
* _.result(object, 'a[0].b.c3', _.constant('default'));
|
||||
* result(object, 'a[0].b.c3', constant('default'));
|
||||
* // => 'default'
|
||||
*/
|
||||
function result(object, path, defaultValue) {
|
||||
|
||||
Reference in New Issue
Block a user