pokemon-dev-utils
Version:
Pokemon utils for developers
82 lines (63 loc) • 1.44 kB
Markdown
寶可夢相關工具集合,提供各種實用功能。
將 pokepaste 網站的隊伍資料轉換為標準化 JSON 格式。
```bash
bun install
bun run build
```
```typescript
import { parsePokepasteUrl, parsePokepasteText } from 'pokemon-utils';
// 從 URL 解析
const result = await parsePokepasteUrl('https://pokepaste.es/abc123');
// 從文字解析
const result = parsePokepasteText(pokepasteString);
if (result.success) {
console.log(result.data.pokemon);
} else {
console.error(result.error);
}
```
```bash
bun run parse https://pokepaste.es/abc123
bun run parse --file team.txt
bun run parse --text "Garchomp @ Choice Scarf..."
```
```json
{
"title": "隊伍名稱",
"author": "作者",
"pokemon": [
{
"name": "Garchomp",
"level": 50,
"gender": "Male",
"ability": "Rough Skin",
"item": "Choice Scarf",
"nature": "Adamant",
"teraType": "Ground",
"evs": { "hp": 4, "attack": 252, "speed": 252, ... },
"ivs": { "hp": 31, "attack": 31, ... },
"moves": ["Earthquake", "Dragon Claw", ...]
}
],
"metadata": {
"source": "pokepaste",
"parsedAt": "2025-08-23T...",
"originalUrl": "https://pokepaste.es/..."
}
}
```
```bash
bun test
```