Tarot.js is a powerful and customizable JavaScript library for creating and managing Tarot card decks, custom spreads, and readings. Whether you're a Tarot enthusiast or a developer looking to integrate Tarot readings into your application, Tarot.js offers a flexible toolkit to enhance your experience.
Features
Deck Management: Easily draw, shuffle, and get details about your Tarot deck.
Custom Spreads: Create and manage unique Tarot spreads tailored to your needs.
Readings: Perform readings using your custom spreads, drawing the specified number of cards for each position.
Current Spread Tracking: View the most recent spread and cards drawn for a convenient reference.
Detailed Deck Information: Retrieve full deck details, including card counts and each card’s metadata.
importTarotfrom"https://esm.sh/gh/MarketingPipeline/Tarot.js";// Load a existing tarot deck via ES6 assert import or via fetch etc... importenglishDeckfrom"https://esm.sh/gh/MarketingPipeline/Tarot.js/decks/en/default.json"assert{type: "json" };// Initialize a Tarot instance and deckconsttarot=newTarot.Tarot();tarot.initializeDeck(englishDeck);// Access current deck and spread informationconsole.log(tarot.getDeckInfo());// Add a spread (e.g., Past, Present, Future)tarot.addSpread('Three-Card Spread',{positions: ['Past','Present','Future'],description: 'Insight into past, present, and future aspects.'});// Perform a reading using the spreadconsole.log(tarot.doReading("Three-Card Spread"));// Make your own deckconstyour_own_custom_deck=tarot.initializeDeck([{name: "The Fool",meaning: "New beginnings, innocence",whatever_key_names_you_want: "l33t"},{name: "The Coder",meaning: "Tired, broke, curious",whatever_values_you_want: ["dope"]}/* Add more card objects as needed. Note: Objects must be same length or greater as your positions in your spread. */]);// Add your custom spreadtarot.addSpread("shakespeare",{positions: ["To be","Not to be"],description: "Random example spread"});console.log(tarot.doReading("shakespeare"));// View the most recent spread and cards drawnconsole.log(tarot.getCurrentSpread());
For more advanced usage you can find the Tarot.js documentation here.
Contributing
Contributions are welcome! Feel free to submit issues, suggest features, or create pull requests to improve Tarot.js.
See also the list of
contributors who
participate in this project.
License
This project is licensed under the MIT License - see the
LICENSE file for details.