diff --git a/src/math.ts b/src/math.ts deleted file mode 100644 index b7bfc7c5..00000000 --- a/src/math.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function max(a: number, b: number): number { - return a > b ? a : b; -} - -export function min(a: number, b: number): number { - return a < b ? a : b; -} diff --git a/src/metrics.ts b/src/metrics.ts index 7c24e044..57e1979e 100644 --- a/src/metrics.ts +++ b/src/metrics.ts @@ -6,7 +6,6 @@ import { HttpOptions } from './http-options'; import { suffixSlash, resolveUrl } from './url-utils'; import { UnleashEvents } from './events'; import { getAppliedJitter } from './helpers'; -import { max, min } from './math'; export interface MetricsOptions { appName: string; @@ -198,7 +197,7 @@ export default class Metrics extends EventEmitter { } backoff(url: string, statusCode: number): void { - this.failures = min(10, this.failures + 1); + this.failures = Math.min(10, this.failures + 1); // eslint-disable-next-line max-len this.emit(UnleashEvents.Warn, `${url} returning ${statusCode}. Backing off to ${this.getInterval()}`); this.startTimer(); @@ -253,7 +252,7 @@ export default class Metrics extends EventEmitter { } reduceBackoff(): void { - this.failures = max(0, this.failures - 1); + this.failures = Math.max(0, this.failures - 1); this.startTimer(); } diff --git a/src/repository/index.ts b/src/repository/index.ts index ef514989..9b6e63e3 100644 --- a/src/repository/index.ts +++ b/src/repository/index.ts @@ -9,7 +9,6 @@ import { BootstrapProvider } from './bootstrap-provider'; import { StorageProvider } from './storage-provider'; import { UnleashEvents } from '../events'; import { Segment } from '../strategy/strategy'; -import { max, min } from '../math'; const SUPPORTED_SPEC_VERSION = '4.3.0'; @@ -258,12 +257,12 @@ Message: ${err.message}`, } private backoff(): number { - this.failures = min(this.failures + 1, 10); + this.failures = Math.min(this.failures + 1, 10); return this.nextFetch(); } private countSuccess(): number { - this.failures = max(this.failures - 1, 0); + this.failures = Math.max(this.failures - 1, 0); return this.nextFetch(); }