MCPcopy Index your code
hub / github.com/deployd/deployd / result

Function result

test-app/public/sinon.js:24249–24269  ·  view source on GitHub ↗

* 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

(object, path, defaultValue)

Source from the content-addressed store, hash-verified

24247 * // => 'default'
24248 */
24249 function result(object, path, defaultValue) {
24250 path = castPath(path, object);
24251
24252 var index = -1,
24253 length = path.length;
24254
24255 // Ensure the loop is entered when path is empty.
24256 if (!length) {
24257 length = 1;
24258 object = undefined;
24259 }
24260 while (++index < length) {
24261 var value = object == null ? undefined : object[toKey(path[index])];
24262 if (value === undefined) {
24263 index = length;
24264 value = defaultValue;
24265 }
24266 object = isFunction(value) ? value.call(object) : value;
24267 }
24268 return object;
24269 }
24270
24271 /**
24272 * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,

Callers 1

getIterateeFunction · 0.85

Calls 3

castPathFunction · 0.85
toKeyFunction · 0.85
isFunctionFunction · 0.70

Tested by

no test coverage detected