npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mtg-parser

v0.1.0

Published

A compilation of handy parsers for popular Magic the Gathering deck text representation formats.

Readme

MTG Parsers

MTG Parser is a npm module providing a compilation of handy parsers for popular Magic the Gathering deck textual formats.

Installation

Through npm

npm install mtg-parser

Through your package.json dependencies

"dependencies": {
	"mtg-parser": "0.1.0"
}

Usage

var mtgparser = require('mtg-parser');

var deck = mtgparser(deck_string, format);
>>> {cards: [], sideboard: [] ...}

The parser returns an objects containing at least an array of the deck's cards and another with its sideboard's cards (if this one exists). Sometimes, depending on the format, the parser may return additional metadata such as the name of the author or the source url.

Both cards arrays contain card objects defined by a minimum of a number of occurrences and a card name. Some format may also provide an edition.

Example

Passing this dummy and quite empty deck

// NAME : Dummy deck
// FORMAT : Standard
        2 Nykthos, Shrine to Nyx
        18 Forest
        2 Nylea, God of the Hunt
SB:  3 Leafcrown Dryad
var mtgparser = require('mtg-parser');
var deck = mtgparser(deck_string, 'mtgo');

would return

{
	name: 'Dummy deck',
	format: 'Standard',
	cards: [
		{number: 2, name: 'Nykthos, Shrine to Nyx'},
		{number: 18, name: 'Forest'},
		{number: 2, name: 'Nylea, God of the Hunt'}
	],
	sideboard: [
		{number: 3, name: 'Leafcrown Dryad'}
	]
}

Supported Formats

MTG Online

identifier: mtgo

// NAME : Deck Bloc Dévotion à Nyléa
// CREATOR : ShadowsSoul (magic-ville.com)
// FORMAT : Standard
        2 Nykthos, Shrine to Nyx
        18 Forest
        2 Nylea, God of the Hunt
        2 Polukranos, World Eater
        3 Centaur Battlemaster
        3 Karametra's Acolyte
        3 Reverent Hunter
        3 Sylvan Caryatid
        4 Arbor Colossus
        4 Nylea's Disciple
        4 Sedge Scorpion
        2 Bow of Nylea
        4 Ordeal of Nylea
        4 Defend the Hearth
        4 Warrior's Lesson
SB:  3 Leafcrown Dryad
SB:  4 Fade into Antiquity
SB:  4 Mistcutter Hydra
SB:  4 Savage Surge

Magic Workstation

identifier: mws

// Deck file for Magic Workstation (http://www.magicworkstation.com)
// NAME : WW Human
// CREATOR : meltiin (magic-ville.com)
// FORMAT : Standard
        4 [M14] Mutavault
        18 [UNH] Plains
        2 [GTC] Daring Skyjek
        4 [RTR] Azorius Arrester
        4 [M14] Banisher Priest
        4 [GTC] Boros Elite
        4 [RTR] Dryad Militant
        4 [M14] Imposing Sovereign
        4 [RTR] Precinct Captain
        4 [THS] Soldier of the Pantheon
        3 [THS] Spear of Heliod
        1 [RTR] Rootborn Defenses
        4 [M14] Brave the Elements
SB:  1 [DGM] Wear/Tear
SB:  2 [THS] Glare of Heresy
SB:  3 [M14] Fiendslayer Paladin
SB:  3 [DGM] Riot Control
SB:  3 [M14] Ajani, Caller of the Pride
SB:  3 [RTR] Rootborn Defenses

MTG Salvation

identifier: mtgs

[DECK]
4x	Ancient Stirrings
2x	Breeding Pool
4x	Deathrender
4x	Deathrite Shaman
3x	Emrakul, the Aeons Torn
4x	Fauna Shaman
1x	Forest
2x	Liliana of the Veil
1x	Marsh Flats
4x	Misty Rainforest
4x	Noble Hierarch
3x	Overgrown Tomb
4x	Serum Visions
2x	Steelshaper's Gift
1x	Swamp
4x	Sylvan Caryatid
1x	Temple Garden
4x	Verdant Catacombs
4x	Viscera Seer
2x	Watery Grave
2x	Wild Cantor

Sideboard
3x	Abrupt Decay
3x	Damnation
4x	Leyline of Sanctity
3x	Leyline of the Void
2x	Remand
[/DECK]
[URL="http://tappedout.net/mtg-decks/deathrender-a-combo-concept/"]Link to deck @ TappedOut.net[/URL]

Contribution

Please feel free to contribute to this compilation of parsers. If you do so, please add unit tests accordingly. You can run them with the following command.

npm test