X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=node_modules%2Funcss%2Fnode_modules%2Flodash%2FsortedLastIndexOf.js;fp=node_modules%2Funcss%2Fnode_modules%2Flodash%2FsortedLastIndexOf.js;h=c09510f1e8df6c6ba22bb9ff5afa54ca5194a134;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/node_modules/uncss/node_modules/lodash/sortedLastIndexOf.js b/node_modules/uncss/node_modules/lodash/sortedLastIndexOf.js new file mode 100644 index 000000000..c09510f1e --- /dev/null +++ b/node_modules/uncss/node_modules/lodash/sortedLastIndexOf.js @@ -0,0 +1,30 @@ +var baseSortedIndex = require('./internal/baseSortedIndex'), + eq = require('./eq'); + +/** + * This method is like `_.lastIndexOf` except that it performs a binary + * search on a sorted `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.sortedLastIndexOf([1, 1, 2, 2], 2); + * // => 3 + */ +function sortedLastIndexOf(array, value) { + var length = array ? array.length : 0; + if (length) { + var index = baseSortedIndex(array, value, true) - 1; + if (eq(array[index], value)) { + return index; + } + } + return -1; +} + +module.exports = sortedLastIndexOf;