MCPcopy
hub / github.com/Kong/insomnia / lazyValue

Function lazyValue

packages/insomnia/bin/yarn-standalone.js:9489–9536  ·  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

9487 * @returns {*} Returns the unwrapped value.
9488 */
9489 function lazyValue() {
9490 var array = this.__wrapped__.value(),
9491 dir = this.__dir__,
9492 isArr = isArray(array),
9493 isRight = dir < 0,
9494 arrLength = isArr ? array.length : 0,
9495 view = getView(0, arrLength, this.__views__),
9496 start = view.start,
9497 end = view.end,
9498 length = end - start,
9499 index = isRight ? end : (start - 1),
9500 iteratees = this.__iteratees__,
9501 iterLength = iteratees.length,
9502 resIndex = 0,
9503 takeCount = nativeMin(length, this.__takeCount__);
9504
9505 if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
9506 return baseWrapperValue(array, this.__actions__);
9507 }
9508 var result = [];
9509
9510 outer:
9511 while (length-- && resIndex < takeCount) {
9512 index += dir;
9513
9514 var iterIndex = -1,
9515 value = array[index];
9516
9517 while (++iterIndex < iterLength) {
9518 var data = iteratees[iterIndex],
9519 iteratee = data.iteratee,
9520 type = data.type,
9521 computed = iteratee(value);
9522
9523 if (type == LAZY_MAP_FLAG) {
9524 value = computed;
9525 } else if (!computed) {
9526 if (type == LAZY_FILTER_FLAG) {
9527 continue outer;
9528 } else {
9529 break outer;
9530 }
9531 }
9532 }
9533 result[resIndex++] = value;
9534 }
9535 return result;
9536 }
9537
9538 // Ensure `LazyWrapper` is an instance of `baseLodash`.
9539 LazyWrapper.prototype = baseCreate(baseLodash.prototype);

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected