Skip to content

Commit

Permalink
refactor(vectors): minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Apr 1, 2021
1 parent c582a1a commit 87eac78
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/vectors/src/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import type { ReadonlyVec, Vec } from "./api";
import { set } from "./set";

export const copy = (v: ReadonlyVec): Vec =>
implementsFunction(v, "copy") ? (<any>v).copy() : set([], v);
implementsFunction(v, "copy") ? v.copy() : set([], v);

export const copyVectors = (pts: ReadonlyVec[]) => pts.map(copy);
2 changes: 1 addition & 1 deletion packages/vectors/src/empty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import type { ReadonlyVec, Vec } from "./api";
import { zeroes } from "./setn";

export const empty = (v: ReadonlyVec): Vec =>
implementsFunction(v, "empty") ? (<any>v).empty() : zeroes(v.length);
implementsFunction(v, "empty") ? v.empty() : zeroes(v.length);
4 changes: 2 additions & 2 deletions packages/vectors/src/eqdelta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export const eqDelta: MultiVecOpRoVVO<boolean, number> = vop();

eqDelta.default((v1, v2, eps = EPS) => {
if (implementsFunction(v1, "eqDelta")) {
return (<any>v1).eqDelta(v2, eps);
return v1.eqDelta(v2, eps);
}
if (implementsFunction(v2, "eqDelta")) {
return (<any>v2).eqDelta(v1, eps);
return v2.eqDelta(v1, eps);
}
return eqDeltaS(v1, v2, v1.length, eps);
});
Expand Down

0 comments on commit 87eac78

Please sign in to comment.