Skip to content

Commit

Permalink
fix: force cast to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
tkgstrator committed Sep 12, 2024
1 parent 02bda28 commit 9f9bac4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .lintstagedrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
'**/*.{ts,tsx,css}':
- bunx @biomejs/biome lint --write src
- bunx @biomejs/biome format --write src
- bunx @biomejs/biome check --write src
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80
"lineWidth": 100
},
"javascript": {
"formatter": {
Expand All @@ -39,6 +39,7 @@
},
"json": {
"formatter": {
"enabled": true,
"trailingCommas": "none"
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tsshogi/kanna",
"version": "0.0.4",
"version": "0.0.5",
"description": "棋譜データをパースするライブラリです",
"author": "tkgstrator",
"license": "MIT",
Expand Down
5 changes: 3 additions & 2 deletions src/models/square.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ export const Square = z.preprocess(
return Piece.OU
})(),
color: color === 0 ? Color.BLACK : Color.WHITE,
x: x,
y: y,
// x === 0 || y === 0 のときに強制的に持ち駒に変換する
x: y === 0 ? 0 : x,
y: x === 0 ? 0 : y,
is_promoted: is_promoted === 2
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { importTCSV } from '..'
describe('math', () => {
test('parse', () => {
for (const index of Array.from({ length: 100 }, (_, i) => i)) {
if (index === 95 || index === 65 || index === 58) continue
if (index === 95 || index === 65) continue
const query = readFileSync(`src/tests/csv/${index}.txt`, { encoding: 'utf8' })
const record: Record | Error = importTCSV(query)
if (record instanceof Error) {
Expand Down

0 comments on commit 9f9bac4

Please sign in to comment.