00001 var baseSlice = require('./_baseSlice'); 00002 00014 function baseWhile(array, predicate, isDrop, fromRight) { 00015 var length = array.length, 00016 index = fromRight ? length : -1; 00017 00018 while ((fromRight ? index-- : ++index < length) && 00019 predicate(array[index], index, array)) {} 00020 00021 return isDrop 00022 ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) 00023 : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); 00024 } 00025 00026 module.exports = baseWhile;