Skip to content

Commit

Permalink
Improve path2d
Browse files Browse the repository at this point in the history
  • Loading branch information
G43riko committed Jan 8, 2025
1 parent ed38427 commit 0d7fb24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion workspaces/tools/deno.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@g43/tools",
"version": "0.0.3",
"version": "0.0.5",
"exports": "./src/index.ts"
}
7 changes: 5 additions & 2 deletions workspaces/tools/src/path-2d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ export class Path2D<T extends ReadonlySimpleVector2 = ReadonlySimpleVector2> {
}
}

public getFirstN(count: number): readonly ReadonlySimpleVector2[] {
public getFirstN(count: number): T[] {
return this.points.slice(0, count);
}
public getFrom(index: number): T[] {
return this.points.slice(index);
}

public getLastN(count: number): readonly ReadonlySimpleVector2[] {
public getLastN(count: number): T[] {
return this.points.slice(this.points.length - count, this.points.length);
}

Expand Down

0 comments on commit 0d7fb24

Please sign in to comment.