Skip to content

Commit

Permalink
refactor(vectors): rename internals
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Oct 12, 2021
1 parent 055e799 commit 51b3687
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/vectors/src/internal/ensure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
4 changes: 2 additions & 2 deletions packages/vectors/src/max-bounds.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/vectors/src/mean.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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]);
Expand Down
4 changes: 2 additions & 2 deletions packages/vectors/src/median.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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; ) {
Expand Down
4 changes: 2 additions & 2 deletions packages/vectors/src/min-bounds.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;
Expand Down

0 comments on commit 51b3687

Please sign in to comment.