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 🙏

© 2024 – Pkg Stats / Ryan Hefner

deckform

v1.0.0

Published

Read deck list (my own format)

Downloads

1

Readme

This program parse deck (of customizable card games such as Magic: the
Gathering) from my own "deckform" format.

This module exports a function that takes a string containing the contents
of the file (you can use fs.readFileSync to achieve it). The output is an
object which can be converted to JSON; you will get an object containing
the same data if JSON.parse is used, except for the prototypes of card
list objects.

An optional second argument to the function is an object containing any of
the following options:

.caseFoldCards = Normally false; if true, quoted card names are converted
to uppercase. Unquoted card names are always converted to uppercase.

The object it returns has properties whose names are all uppercase.
Directives become properties whose values are primitives (string, number,
true, false, or null), while outer blocks become properties whose values
are arrays. Each element of the array represents one outer block (there
may be multiple elements if there are multiple outer blocks with the same
name as each other).

An outer block object has properties named by directives and inner blocks.
Directives from the top of the file are also copied into each outer block
object unless they are overridden by directives inside the outer block.
Inner blocks are card list objects, which have no prototype. A card list
object has properties named by the cards in that list; the value of the
property is a number indicating how many copies of that card.

The function also exports some properties which are also functions:

.convert(obj) = Converts a object from the "mtg-parser" package's output
to deckform source format (as a string, not as an object).

.export(obj) = Convert output from this module's main export function into
deckform source format. It doesn't care whether or not the card list
objects have a prototype.

.total(cardlist) = Return a number which is the total number of cards in
the card list.