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

Function lazyValue

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

* Extracts the unwrapped value from its lazy wrapper. * * @private * @name value * @memberOf LazyWrapper * @returns {*} Returns the unwrapped value.

()

Source from the content-addressed store, hash-verified

12465 * @returns {*} Returns the unwrapped value.
12466 */
12467 function lazyValue() {
12468 var array = this.__wrapped__.value(),
12469 dir = this.__dir__,
12470 isArr = isArray(array),
12471 isRight = dir < 0,
12472 arrLength = isArr ? array.length : 0,
12473 view = getView(0, arrLength, this.__views__),
12474 start = view.start,
12475 end = view.end,
12476 length = end - start,
12477 index = isRight ? end : (start - 1),
12478 iteratees = this.__iteratees__,
12479 iterLength = iteratees.length,
12480 resIndex = 0,
12481 takeCount = nativeMin(length, this.__takeCount__);
12482
12483 if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
12484 return baseWrapperValue(array, this.__actions__);
12485 }
12486 var result = [];
12487
12488 outer:
12489 while (length-- && resIndex < takeCount) {
12490 index += dir;
12491
12492 var iterIndex = -1,
12493 value = array[index];
12494
12495 while (++iterIndex < iterLength) {
12496 var data = iteratees[iterIndex],
12497 iteratee = data.iteratee,
12498 type = data.type,
12499 computed = iteratee(value);
12500
12501 if (type == LAZY_MAP_FLAG) {
12502 value = computed;
12503 } else if (!computed) {
12504 if (type == LAZY_FILTER_FLAG) {
12505 continue outer;
12506 } else {
12507 break outer;
12508 }
12509 }
12510 }
12511 result[resIndex++] = value;
12512 }
12513 return result;
12514 }
12515
12516 // Ensure `LazyWrapper` is an instance of `baseLodash`.
12517 LazyWrapper.prototype = baseCreate(baseLodash.prototype);

Callers

nothing calls this directly

Calls 4

getViewFunction · 0.85
baseWrapperValueFunction · 0.85
iterateeFunction · 0.85
isArrayFunction · 0.70

Tested by

no test coverage detected