Skip to content

Commit

Permalink
chore: removed duplicate interface
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAegis committed Jan 14, 2024
1 parent 2efdf9a commit 7d47fba
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
7 changes: 5 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion solutions/typescript/2018/03/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"./readme": "./readme.md"
},
"dependencies": {
"@alexaegis/advent-of-code-lib": "workspace:^"
"@alexaegis/advent-of-code-lib": "workspace:^",
"arktype": "^1.0.29-alpha"
},
"devDependencies": {
"@alexaegis/eslint-config-vitest": "^0.9.2",
Expand Down
12 changes: 8 additions & 4 deletions solutions/typescript/2018/03/src/interpret.function.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { Vec2 } from '@alexaegis/advent-of-code-lib';
import { type } from 'arktype';
import type { Claim } from './model/claim.interface.js';

export const interpret = (line: string): Claim => {
const parts = line.split(/[#,:@x]/).map((e) => e.trim());
const strings = type(['string', 'string', 'string', 'string', 'string', 'string']);
const parts = strings.assert(line.split(/[#,:@x]/).map((e) => e.trim()));

return {
id: Number(parts[1]),
starting: { x: Number(parts[2]), y: Number(parts[3]) },
size: { x: Number(parts[4]), y: Number(parts[5]) },
id: Number.parseInt(parts[1], 10),
starting: new Vec2(Number.parseInt(parts[2], 10), Number.parseInt(parts[3], 10)),
size: new Vec2(Number.parseInt(parts[4], 10), Number.parseInt(parts[5], 10)),
};
};
6 changes: 3 additions & 3 deletions solutions/typescript/2018/03/src/model/claim.interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Coord } from './coord.interface.js';
import type { Vec2 } from '@alexaegis/advent-of-code-lib';

export interface Claim {
id: number;
starting: Coord;
size: Coord;
starting: Vec2;
size: Vec2;
}
5 changes: 0 additions & 5 deletions solutions/typescript/2018/15/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@
"import": "./dist/cave.class.js",
"default": "./dist/cave.class.js"
},
"./coord.class": {
"types": "./src/coord.class.ts",
"import": "./dist/coord.class.js",
"default": "./dist/coord.class.js"
},
"./reader.function": {
"types": "./src/reader.function.ts",
"import": "./dist/reader.function.js",
Expand Down

0 comments on commit 7d47fba

Please sign in to comment.