mirror of
https://github.com/NomaDamas/k-skill.git
synced 2026-06-24 02:04:11 +00:00
Correct the documented kbo-game call pattern
The published kbo-game package does not match the README example, so the KBO skill docs now show the API shape that actually works in practice. The examples use the exported getGame function and convert YYYY-MM-DD inputs into Date objects before calling it. Constraint: Must document the currently published kbo-game@0.0.2 behavior without adding new dependencies Rejected: Keep the upstream README example | local reproduction shows it throws at runtime Confidence: high Scope-risk: narrow Reversibility: clean Directive: Re-verify the package exports before changing these examples if kbo-game releases a new version Tested: Local npm install of kbo-game; reproduced getGameInfo failure; verified getGame(new Date(...)) success; npm run ci Not-tested: Future kbo-game releases with different exports or argument contracts
This commit is contained in:
parent
346b68fd0e
commit
ec41ff08dc
2 changed files with 8 additions and 4 deletions
|
|
@ -26,15 +26,17 @@
|
|||
|
||||
```bash
|
||||
node --input-type=module - <<'JS'
|
||||
import { getGameInfo } from "kbo-game";
|
||||
import { getGame } from "kbo-game";
|
||||
|
||||
const date = "2026-03-25";
|
||||
const games = await getGameInfo(date);
|
||||
const games = await getGame(new Date(`${date}T00:00:00+09:00`));
|
||||
console.log(JSON.stringify(games, null, 2));
|
||||
JS
|
||||
```
|
||||
|
||||
## 주의할 점
|
||||
|
||||
- `kbo-game@0.0.2`의 실제 export는 `getGame`입니다. README에 나온 `getGameInfo` 예시는 동작하지 않습니다.
|
||||
- `getGame`은 문자열이 아니라 `Date` 객체를 받습니다. `"YYYY-MM-DD"`를 그대로 넘기면 `date.getFullYear is not a function` 오류가 납니다.
|
||||
- 비시즌 날짜는 빈 결과가 올 수 있습니다.
|
||||
- 사용자의 "오늘/어제" 요청은 항상 절대 날짜로 바꿔 실행하는 편이 안전합니다.
|
||||
|
|
|
|||
|
|
@ -36,14 +36,16 @@ metadata:
|
|||
|
||||
```bash
|
||||
node --input-type=module - <<'JS'
|
||||
import { getGameInfo } from "kbo-game";
|
||||
import { getGame } from "kbo-game";
|
||||
|
||||
const date = "2026-03-25";
|
||||
const games = await getGameInfo(date);
|
||||
const games = await getGame(new Date(`${date}T00:00:00+09:00`));
|
||||
console.log(JSON.stringify(games, null, 2));
|
||||
JS
|
||||
```
|
||||
|
||||
`kbo-game@0.0.2` 기준 실제 export는 `getGame` 하나이며, 문자열 날짜(`"2026-03-25"`)를 직접 넘기면 실패한다. 항상 `Date` 객체로 변환해서 호출한다.
|
||||
|
||||
### 2. Normalize for humans
|
||||
|
||||
원본 데이터를 그대로 던지지 말고 아래 기준으로 정리한다.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue