X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Fgrunt-legacy-log%2Fnode_modules%2Flodash%2Finternal%2FbaseWhile.js;fp=node_modules%2Fgrunt-legacy-log%2Fnode_modules%2Flodash%2Finternal%2FbaseWhile.js;h=c24e9bd9d9c9ff34ea6c78281247b7b5aed0381f;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/grunt-legacy-log/node_modules/lodash/internal/baseWhile.js b/node_modules/grunt-legacy-log/node_modules/lodash/internal/baseWhile.js new file mode 100644 index 000000000..c24e9bd9d --- /dev/null +++ b/node_modules/grunt-legacy-log/node_modules/lodash/internal/baseWhile.js @@ -0,0 +1,24 @@ +var baseSlice = require('./baseSlice'); + +/** + * The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`, + * and `_.takeWhile` without support for callback shorthands and `this` binding. + * + * @private + * @param {Array} array The array to query. + * @param {Function} predicate The function invoked per iteration. + * @param {boolean} [isDrop] Specify dropping elements instead of taking them. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the slice of `array`. + */ +function baseWhile(array, predicate, isDrop, fromRight) { + var length = array.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {} + return isDrop + ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) + : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index)); +} + +module.exports = baseWhile;