-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.mjs
31 lines (26 loc) · 864 Bytes
/
main.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Main entrypoint (ESM) module
*
* @author Adam Lacoste <[email protected]>
* @copyright 2021 Adam Lacoste
*
* @module card-sharp/mjs
*
* @requires deep-extend
* @requires card-sharp/lib/card
* @requires card-sharp/lib/deck
*/
import extend from "deep-extend";
import Card from "./lib/card.mjs";
import Deck from "./lib/deck.mjs";
import std_deck from "./config/decks/standard.json";
import stdj_deck from "./config/decks/standard_jokers.json";
const config = { "decks": { "standard": std_deck, "standard_jokers": stdj_deck } },
default_opts = { "cards": std_deck };
function init(user_opts = {}) {
let opts = extend({}, default_opts, user_opts),
cards = Card.fromArray(opts.cards);
return new Deck(cards);
} // end function init
export { Card, Deck, config, init };
export default init;