diff options
Diffstat (limited to 'tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/arrayMax.js')
-rw-r--r-- | tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/arrayMax.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/arrayMax.js b/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/arrayMax.js new file mode 100644 index 0000000000..3f62469f91 --- /dev/null +++ b/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/arrayMax.js @@ -0,0 +1,25 @@ +/** Used as references for `-Infinity` and `Infinity`. */ +var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY; + +/** + * A specialized version of `_.max` for arrays without support for iteratees. + * + * @private + * @param {Array} array The array to iterate over. + * @returns {*} Returns the maximum value. + */ +function arrayMax(array) { + var index = -1, + length = array.length, + result = NEGATIVE_INFINITY; + + while (++index < length) { + var value = array[index]; + if (value > result) { + result = value; + } + } + return result; +} + +module.exports = arrayMax; |