DEV Community


My first npm package: ptcgo-parser

Juha-Matti Santala
I'm a developer community builder and full-stack web developer from Finland. I blog occasionally here and weekly at my own blog at
・3 min read


Over the past couple of years I've built a couple of prototypes for myself and few players in my local and online communities to help us become better Pokemon TCG players. Based on those projects, I published my first npm package today.

Some of my prototypes are Proxymon which is now outdated, missing recent sets but still functional in printing proxies for playtesting and pkmn-attack-damage that I built one Saturday night after a discussion in a Discord community.

Meet ptcgo-parser!

I wrote hamatti/ptcgo-parser to learn how to build npm packages and to alleviate my pains of copy-pasting and rewriting that parsing part for all my projects. I'm a huge fan of API and decided to bundle in compatibility for that API.

Quick Guide

You can install the package via npm with

npm install ptcgo-parser

and then use it in your own code, providing a Pokemon TCG Online decklist export as an argument to it's only exposed function parse:

const PTCGOParser = require('ptcgo-parser')

const ptcgoExportedDecklist = `
****** Pokémon Trading Card Game Deck List ******

##Pokémon - 13

* 1 Oranguru SUM 113
* 3 Darkrai-EX BKP 74
* 4 Dratini SUM 94
* 3 Dragonair SUM 95
* 1 Dragonite ROS 51
* 1 Mew FAC 29

const decklist = PTCGOParser.parse(ptcgoExportedDecklist)


    cards: [
            name: 'Oranguru',
            amount: 1,
            set: 'SUM',
            code: 113,
            ptcgoio: {
                id: 'sm1-113'

It will return you the parsed version of the card but also includes ID that you can use to fetch more information from the API.

Known issues

The initial launch functions but it still has bunch of known issues, mainly that some cards (like Rainbow Rares) are not available in the API. I will continue working on the package to bring it to a point where 1.0.0 launch will contain exceptions for missing cards so that you can get the correct card, even if the wrong rarity.

If you are a developer and Pokemon TCG player, take it a spin and let me know how I can improve it to make it perfect for your use cases.

Publishing a package in npm

I was surprised how easy the workflow for publishing a package in npm is. All you need to do, is to create an account to, create a package.json file, write some code and run npm publish on your command line.

And with, you can get this cool badges that you can put to your documentation:

npm badge


There's still lots of work to do with the library, especially making it more stable in terms of missing or mismatching cards. But wrapping it in a npm package forced me to think about the API and what format it returns the data as well as thinking about the documentation.

If you wanna learn how to write good documentation, @jamesstone has collected great resources to his repository jamesstoneco/docsthursday.

The development of ptcgo-parser was supported by Spice Program.

Discussion (0)