open-index/open-npm huggingface dataset:
npm package: @1hko/mtg
Description: mtg tools
Author: 1hko
Latest version: 0.0.6

mtg
===

**parseDeck** - parse a decklist to `[{ board, count, name, set, collector_number }]`. Throws `Error { board, lineno, line }` when an input line is invalid.

```js
const decklist = `
  1 Ulamog, the Infinite Gyre (mm2) 6
  4 Urza's Mine (atq) 83c
  4 Urza's Power Plant (atq) 84a
  4 Urza's Tower (atq) 85a
  4 Wall of Tanglecord (som) 222

  SIDEBOARD:
  1 Channel the Suns (5dn) 84
  4 Cloudpost (mrd) 280
`

parseDeck(decklist)
```

```js
[
  { board: "main", "count": 1, "set": "mm2", "collector_number": "6" },
  { board: "main", "count": 4, "set": "atq", "collector_number": "83c" },
  { board: "main", "count": 4, "set": "atq", "collector_number": "84a" },
  { board: "main", "count": 4, "set": "atq", "collector_number": "85a" },
  { board: "main", "count": 4, "set": "som", "collector_number": "222" },
  { board: "side", "count": 1, "set": "5dn", "collector_number": "84" },
  { board: "side", "count": 4, "set": "mrd", "collector_number": "280" }
]
```