X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Fgrunt-uncss%2Fnode_modules%2Flodash%2FpullAt.js;fp=node_modules%2Fgrunt-uncss%2Fnode_modules%2Flodash%2FpullAt.js;h=6ed84e064dd079c40211bfc0e5e4ee4b9d912237;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/grunt-uncss/node_modules/lodash/pullAt.js b/node_modules/grunt-uncss/node_modules/lodash/pullAt.js new file mode 100644 index 000000000..6ed84e064 --- /dev/null +++ b/node_modules/grunt-uncss/node_modules/lodash/pullAt.js @@ -0,0 +1,43 @@ +var arrayMap = require('./_arrayMap'), + baseAt = require('./_baseAt'), + basePullAt = require('./_basePullAt'), + compareAscending = require('./_compareAscending'), + flatRest = require('./_flatRest'), + isIndex = require('./_isIndex'); + +/** + * Removes elements from `array` corresponding to `indexes` and returns an + * array of removed elements. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Array + * @param {Array} array The array to modify. + * @param {...(number|number[])} [indexes] The indexes of elements to remove. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = ['a', 'b', 'c', 'd']; + * var pulled = _.pullAt(array, [1, 3]); + * + * console.log(array); + * // => ['a', 'c'] + * + * console.log(pulled); + * // => ['b', 'd'] + */ +var pullAt = flatRest(function(array, indexes) { + var length = array == null ? 0 : array.length, + result = baseAt(array, indexes); + + basePullAt(array, arrayMap(indexes, function(index) { + return isIndex(index, length) ? +index : index; + }).sort(compareAscending)); + + return result; +}); + +module.exports = pullAt;