X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Fgrunt-legacy-log-utils%2Fnode_modules%2Flodash%2F_basePullAt.js;fp=node_modules%2Fgrunt-legacy-log-utils%2Fnode_modules%2Flodash%2F_basePullAt.js;h=206b1965f5703492aedfbabee31fcd77b564f5af;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/grunt-legacy-log-utils/node_modules/lodash/_basePullAt.js b/node_modules/grunt-legacy-log-utils/node_modules/lodash/_basePullAt.js new file mode 100644 index 000000000..206b1965f --- /dev/null +++ b/node_modules/grunt-legacy-log-utils/node_modules/lodash/_basePullAt.js @@ -0,0 +1,49 @@ +var baseToPath = require('./_baseToPath'), + isIndex = require('./_isIndex'), + isKey = require('./_isKey'), + last = require('./last'), + parent = require('./_parent'); + +/** Used for built-in method references. */ +var arrayProto = Array.prototype; + +/** Built-in value references. */ +var splice = arrayProto.splice; + +/** + * The base implementation of `_.pullAt` without support for individual + * indexes or capturing the removed elements. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. + */ +function basePullAt(array, indexes) { + var length = array ? indexes.length : 0, + lastIndex = length - 1; + + while (length--) { + var index = indexes[length]; + if (lastIndex == length || index != previous) { + var previous = index; + if (isIndex(index)) { + splice.call(array, index, 1); + } + else if (!isKey(index, array)) { + var path = baseToPath(index), + object = parent(array, path); + + if (object != null) { + delete object[last(path)]; + } + } + else { + delete array[index]; + } + } + } + return array; +} + +module.exports = basePullAt;