@vect/vector-indicator
Advanced tools
Comparing version 0.0.25 to 0.0.26
@@ -9,3 +9,3 @@ 'use strict'; | ||
const fn = this; | ||
return vec.reduce((p, x, i) => comparer.max(p, fn(x, i)), fn(vec[0], 0)); | ||
return !fn ? vec.reduce((p, x) => comparer.max(x, p), vec[0]) : vec.reduce((p, x, i) => comparer.max(fn(x, i), p), fn(vec[0], 0)); | ||
}; | ||
@@ -17,3 +17,3 @@ const maxBy = (vec, indicator) => max.call(indicator, vec); | ||
const fn = this; | ||
return vec.reduce((p, x, i) => comparer.min(p, fn(x, i)), fn(vec[0], 0)); | ||
return !fn ? vec.reduce((p, x) => comparer.min(x, p), vec[0]) : vec.reduce((p, x, i) => comparer.min(fn(x, i), p), fn(vec[0], 0)); | ||
}; | ||
@@ -20,0 +20,0 @@ const minBy = (vec, indicator) => min.call(indicator, vec); |
@@ -5,3 +5,3 @@ import { max as max$1, min as min$1 } from '@aryth/comparer'; | ||
const fn = this; | ||
return vec.reduce((p, x, i) => max$1(p, fn(x, i)), fn(vec[0], 0)); | ||
return !fn ? vec.reduce((p, x) => max$1(x, p), vec[0]) : vec.reduce((p, x, i) => max$1(fn(x, i), p), fn(vec[0], 0)); | ||
}; | ||
@@ -13,3 +13,3 @@ const maxBy = (vec, indicator) => max.call(indicator, vec); | ||
const fn = this; | ||
return vec.reduce((p, x, i) => min$1(p, fn(x, i)), fn(vec[0], 0)); | ||
return !fn ? vec.reduce((p, x) => min$1(x, p), vec[0]) : vec.reduce((p, x, i) => min$1(fn(x, i), p), fn(vec[0], 0)); | ||
}; | ||
@@ -16,0 +16,0 @@ const minBy = (vec, indicator) => min.call(indicator, vec); |
{ | ||
"name": "@vect/vector-indicator", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"description": "Indicators for vector", | ||
@@ -38,3 +38,3 @@ "main": "dist/index.cjs.js", | ||
"homepage": "https://github.com/hoyeungw/vect#readme", | ||
"gitHead": "8c6ddf6bb50856583cdc81f29000f6303217f5da" | ||
"gitHead": "1e44271c5142bc2106301fbe51681701809dee8b" | ||
} |
5205