1 var baseWrapperValue = require('./_baseWrapperValue'),
2 getView = require('./_getView'),
3 isArray = require('./isArray');
5 /** Used to indicate the type of lazy iteratees. */
6 var LAZY_FILTER_FLAG = 1,
9 /* Built-in method references for those with the same name as other `lodash` methods. */
10 var nativeMin = Math.min;
13 * Extracts the unwrapped value from its lazy wrapper.
17 * @memberOf LazyWrapper
18 * @returns {*} Returns the unwrapped value.
20 function lazyValue() {
21 var array = this.__wrapped__.value(),
23 isArr = isArray(array),
25 arrLength = isArr ? array.length : 0,
26 view = getView(0, arrLength, this.__views__),
30 index = isRight ? end : (start - 1),
31 iteratees = this.__iteratees__,
32 iterLength = iteratees.length,
34 takeCount = nativeMin(length, this.__takeCount__);
36 if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
37 return baseWrapperValue(array, this.__actions__);
42 while (length-- && resIndex < takeCount) {
48 while (++iterIndex < iterLength) {
49 var data = iteratees[iterIndex],
50 iteratee = data.iteratee,
52 computed = iteratee(value);
54 if (type == LAZY_MAP_FLAG) {
56 } else if (!computed) {
57 if (type == LAZY_FILTER_FLAG) {
64 result[resIndex++] = value;
69 module.exports = lazyValue;