Skip to content

Commit

Permalink
fix(🐛): fix move() typings (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Oct 9, 2020
1 parent 12f25fe commit 01e047b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Array.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const reorder = (input: unknown[], from: number, to: number) => {
export const move = <T>(input: T[], from: number, to: number) => {
"worklet";
const offsets = [...input];
while (from < 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/Paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const parse = (d: string): Path => {
const segments: SVGNormalizedCommands = normalizeSVG(absSVG(parseSVG(d)));
return segments.map((segment, index) => {
if (segment[0] === "M") {
return move(segment[1], segment[2]);
return moveTo(segment[1], segment[2]);
} else if (segment[0] === "Z") {
return close();
} else {
Expand Down Expand Up @@ -248,7 +248,7 @@ export const mixPath = (
/**
* @summary Returns a Bèzier curve command.
*/
export const move = (x: number, y: number) => {
export const moveTo = (x: number, y: number) => {
"worklet";
return { type: SVGCommand.MOVE as const, x, y };
};
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/Array.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { reorder } from "../Array";
import { move } from "../Array";

test("reorder()", () => {
expect(reorder([0, 1, 2, 3, 4], 2, 0)).toStrictEqual([2, 0, 1, 3, 4]);
expect(reorder([0, 1, 2, 3, 4], 3, 2)).toStrictEqual([0, 1, 3, 2, 4]);
expect(move([0, 1, 2, 3, 4], 2, 0)).toStrictEqual([2, 0, 1, 3, 4]);
expect(move([0, 1, 2, 3, 4], 3, 2)).toStrictEqual([0, 1, 3, 2, 4]);
});

0 comments on commit 01e047b

Please sign in to comment.