Decode and encode Marvel Snap deckstrings.
Install the package from npm using your favourite package manager:
$ yarn add marvel-snap-deckstrings
import { encode, decode } from "marvel-snap-deckstrings";
const deck = {
cards: ["ProfessorX", "JessicaJones", "AmericaChavez", "Enchantress"], // dbfId[]
};
const deckstring = encode(deck);
console.log(deckstring); // eyJDYXJkcyI6W3siQ2Fy
const decoded = decode(deckstring);
console.log(JSON.stringify(deck) === JSON.stringify(decoded)); // true