summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/arrayExtremum.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/cli-table2/node_modules/lodash/internal/arrayExtremum.js')
-rw-r--r--deps/npm/node_modules/cli-table2/node_modules/lodash/internal/arrayExtremum.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/arrayExtremum.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/arrayExtremum.js
new file mode 100644
index 0000000000..e45badbda1
--- /dev/null
+++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/arrayExtremum.js
@@ -0,0 +1,30 @@
+/**
+ * A specialized version of `baseExtremum` for arrays which invokes `iteratee`
+ * with one argument: (value).
+ *
+ * @private
+ * @param {Array} array The array to iterate over.
+ * @param {Function} iteratee The function invoked per iteration.
+ * @param {Function} comparator The function used to compare values.
+ * @param {*} exValue The initial extremum value.
+ * @returns {*} Returns the extremum value.
+ */
+function arrayExtremum(array, iteratee, comparator, exValue) {
+ var index = -1,
+ length = array.length,
+ computed = exValue,
+ result = computed;
+
+ while (++index < length) {
+ var value = array[index],
+ current = +iteratee(value);
+
+ if (comparator(current, computed)) {
+ computed = current;
+ result = value;
+ }
+ }
+ return result;
+}
+
+module.exports = arrayExtremum;