From 3dc30632755713179f345f4af024bd904c6162d0 Mon Sep 17 00:00:00 2001 From: Michaƫl Zasso Date: Fri, 22 Dec 2017 16:53:42 +0100 Subject: tools: move eslint from tools to tools/node_modules This is required because we need to add the babel-eslint dependency and it has to be able to resolve "eslint". babel-eslint is required to support future ES features such as async iterators and import.meta. Refs: https://github.com/nodejs/node/pull/17755 PR-URL: https://github.com/nodejs/node/pull/17820 Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum --- .../eslint/node_modules/lodash/lastIndexOf.js | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tools/node_modules/eslint/node_modules/lodash/lastIndexOf.js (limited to 'tools/node_modules/eslint/node_modules/lodash/lastIndexOf.js') diff --git a/tools/node_modules/eslint/node_modules/lodash/lastIndexOf.js b/tools/node_modules/eslint/node_modules/lodash/lastIndexOf.js new file mode 100644 index 0000000000..dabfb613a5 --- /dev/null +++ b/tools/node_modules/eslint/node_modules/lodash/lastIndexOf.js @@ -0,0 +1,46 @@ +var baseFindIndex = require('./_baseFindIndex'), + baseIsNaN = require('./_baseIsNaN'), + strictLastIndexOf = require('./_strictLastIndexOf'), + toInteger = require('./toInteger'); + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/** + * This method is like `_.indexOf` except that it iterates over elements of + * `array` from right to left. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} [fromIndex=array.length-1] The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // Search from the `fromIndex`. + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + */ +function lastIndexOf(array, value, fromIndex) { + var length = array == null ? 0 : array.length; + if (!length) { + return -1; + } + var index = length; + if (fromIndex !== undefined) { + index = toInteger(fromIndex); + index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); + } + return value === value + ? strictLastIndexOf(array, value, index) + : baseFindIndex(array, baseIsNaN, index, true); +} + +module.exports = lastIndexOf; -- cgit v1.2.3