From 51b3687a58d9f0efca60c8e0f4d2b0cd76d49ed0 Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Tue, 12 Oct 2021 15:50:49 +0200 Subject: [PATCH] refactor(vectors): rename internals --- packages/vectors/src/internal/ensure.ts | 2 +- packages/vectors/src/max-bounds.ts | 4 ++-- packages/vectors/src/mean.ts | 4 ++-- packages/vectors/src/median.ts | 4 ++-- packages/vectors/src/min-bounds.ts | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/vectors/src/internal/ensure.ts b/packages/vectors/src/internal/ensure.ts index 51adc3316f..4c1f9483e4 100644 --- a/packages/vectors/src/internal/ensure.ts +++ b/packages/vectors/src/internal/ensure.ts @@ -5,5 +5,5 @@ import { assert } from "@thi.ng/errors/assert"; * * @internal */ -export const ensureInputs = (src: any[]) => +export const __ensureInputs = (src: any[]) => assert(src.length > 0, `no inputs given`); diff --git a/packages/vectors/src/max-bounds.ts b/packages/vectors/src/max-bounds.ts index 76d55bc601..65852382c6 100644 --- a/packages/vectors/src/max-bounds.ts +++ b/packages/vectors/src/max-bounds.ts @@ -1,5 +1,5 @@ import type { ReadonlyVec, Vec } from "./api"; -import { ensureInputs } from "./internal/ensure"; +import { __ensureInputs } from "./internal/ensure"; import { max } from "./max"; import { setN } from "./setn"; import { vecOf } from "./vec-of"; @@ -12,7 +12,7 @@ import { vecOf } from "./vec-of"; * @param src */ export const maxBounds = (out: Vec | null, src: ReadonlyVec[]) => { - ensureInputs(src); + __ensureInputs(src); out = out ? setN(out, -Infinity) : vecOf(src[0].length, -Infinity); for (let i = src.length; --i >= 0; ) max(out, out, src[i]); return out; diff --git a/packages/vectors/src/mean.ts b/packages/vectors/src/mean.ts index 503f5d9b16..45d8da36bc 100644 --- a/packages/vectors/src/mean.ts +++ b/packages/vectors/src/mean.ts @@ -1,6 +1,6 @@ import { add } from "./add"; import type { ReadonlyVec, Vec } from "./api"; -import { ensureInputs } from "./internal/ensure"; +import { __ensureInputs } from "./internal/ensure"; import { mulN } from "./muln"; import { set } from "./set"; import { sum } from "./sum"; @@ -22,7 +22,7 @@ import { sum } from "./sum"; * @param src */ export const mean = (out: Vec | null, src: ReadonlyVec[]) => { - ensureInputs(src); + __ensureInputs(src); out = set(out || [], src[0]); for (let i = src.length; --i >= 1; ) { add(out, out, src[i]); diff --git a/packages/vectors/src/median.ts b/packages/vectors/src/median.ts index 99ce1c0584..7105459346 100644 --- a/packages/vectors/src/median.ts +++ b/packages/vectors/src/median.ts @@ -1,5 +1,5 @@ import type { ReadonlyVec, Vec } from "./api"; -import { ensureInputs } from "./internal/ensure"; +import { __ensureInputs } from "./internal/ensure"; /** * Takes an array of vectors (of uniform dimensions) and computes the @@ -16,7 +16,7 @@ import { ensureInputs } from "./internal/ensure"; * @param src */ export const median = (out: Vec | null, src: ReadonlyVec[]) => { - ensureInputs(src); + __ensureInputs(src); out = out || []; const m = src.length >> 1; for (let i = src[0].length; --i >= 0; ) { diff --git a/packages/vectors/src/min-bounds.ts b/packages/vectors/src/min-bounds.ts index 68030d8950..dfe39a8033 100644 --- a/packages/vectors/src/min-bounds.ts +++ b/packages/vectors/src/min-bounds.ts @@ -1,5 +1,5 @@ import type { ReadonlyVec, Vec } from "./api"; -import { ensureInputs } from "./internal/ensure"; +import { __ensureInputs } from "./internal/ensure"; import { min } from "./min"; import { setN } from "./setn"; import { vecOf } from "./vec-of"; @@ -12,7 +12,7 @@ import { vecOf } from "./vec-of"; * @param src */ export const minBounds = (out: Vec | null, src: ReadonlyVec[]) => { - ensureInputs(src); + __ensureInputs(src); out = out ? setN(out, Infinity) : vecOf(src[0].length, Infinity); for (let i = src.length; --i >= 0; ) min(out, out, src[i]); return out;